ACtE03 · Chapter 3Programming & Applications🏛️ Past Licensure QuestionID: fa6cc3f8
In C++, access specifiers (private, protected, public) apply at the level of the:
In C++, access specifiers (private, protected, public) apply at the level of the:
Multiple Choice Options
- A
Individual object instance only
- B✓ Correct Option
Class definition as a whole (a member function can access private members of ANY object of its own class)
- C
Translation unit file boundary only
- D
Operating system process boundary only
Detailed Technical Solution & Explanation
In C++, encapsulation and access control are class-based, not object-based. A member function of class X can access private and protected members of any instance of class X (e.g., in X::operator=(const X& rhs), this->val = rhs.val is completely legal despite rhs.val being private).
Option Analysis:
•
Option A (Individual object instance only): Common misconception; access control is class-wide.
•
Option B (Class definition as a whole (a member...): Correct. Member functions have access to all instances of their own class.
•
Option C (Translation unit file boundary only): Describes static linkage, not class encapsulation.
•
Option D (Operating system process boundary only): OS-level memory protection, not language access control.
Reference: Mock Test 06NEC Licensure Syllabus