ACtE03 · Chapter 3Programming & Applications🏛️ Past Licensure QuestionID: 59a3d1d1
In an inheritance hierarchy, which object can directly access the accessible members of both the base class and the derived class?
In an inheritance hierarchy, which object can directly access the accessible members of both the base class and the derived class?
Multiple Choice Options
- A
An object of the Base class
- B✓ Correct Option
An object of the Derived class
- C
A pointer to an unrelated class
- D
The static class descriptor
Detailed Technical Solution & Explanation
An instance of a derived class contains all inherited non-private members of its base classes as well as its own members. Therefore, an object of the derived class can access public/protected members of both classes.
Option Analysis:
•
Option A (An object of the Base class): Has no knowledge of or access to derived class extensions.
•
Option B (An object of the Derived class): Correct. Sub-object inheritance provides access to both base and derived members.
•
Option C (A pointer to an unrelated class): Unrelated classes cannot access protected/private members.
•
Option D (The static class descriptor): Does not represent an instance.
Reference: Demo2 · Set 2NEC Licensure Syllabus