12
Consider the following statements regarding C++ object-oriented programming language:
(A) . Public members (both functions and data) can be accessed from outside the class.
(B) . Only the member functions can have access to the private data members and private functions.
(C) . By default, members of a class are public
Choose the correct answer from the options given below:
EXPLANATION
Bio-Programming
- Access Specifiers in C++ Classes:
- Public members of a class can be accessed directly from any code outside the class through object instances. (True)
- Private data members and private member functions are accessible only by member functions of that class (and friend functions/classes). (True)
- By default, all members of a C++
classare private (unlike astruct, where members are public by default). (False) - Conclusion: Only (A) and (B) are true (Option 1).
Correct option: (1) Only (A) and (B) are true.
Explanation not matching this question?
क्या व्याख्या इस प्रश्न से मेल नहीं खा रही?
Report
Want to practice this paper in exam conditions?
क्या आप परीक्षा जैसे माहौल में अभ्यास करना चाहते हैं?
Test yourself in 5-question batch format with timer and hidden answers.
5-प्रश्नों के बैच फॉर्मैट, टाइमर और छिपे उत्तरों के साथ खुद को परखें।
Start Practice Mode →
प्रैक्टिस टेस्ट मोड शुरू करें →