ACtE03 · Chapter 3Programming & Applications🏛️ Past Licensure QuestionID: b8e39fb9
In multiple inheritance (class Derived : public Base1, public Base2), which object can access public members of both base classes as well as its own members?
In multiple inheritance (class Derived : public Base1, public Base2), which object can access public members of both base classes as well as its own members?
Multiple Choice Options
- A
An object of Base1
- B✓ Correct Option
An object of the Derived class
- C
An object of Base2
- D
Any static member pointer
Detailed Technical Solution & Explanation
An object of the Derived class contains both Base1 and Base2 sub-objects. Consequently, the derived object can access the public and protected members of both base classes.
Option Analysis:
•
Option A (An object of Base1): Can only access
Base1 members; unaware of Base2 or Derived.•
Option B (An object of the Derived class): Correct. Derived object contains and accesses members of both base classes.
•
Option C (An object of Base2): Can only access
Base2 members.•
Option D (Any static member pointer): Static members belong to class scope, not multiple inheritance instance access.
Reference: Demo2 · Set 2NEC Licensure Syllabus