Difficulty: Medium
Correct Answer: 11 11 11 22
Explanation:
Introduction / Context:
This question distinguishes a base subobject from a separate contained data member of the same type. It asks you to track constructor argument forwarding and to identify which x each qualified name refers to in the output expression.
Given Data / Assumptions:
Concept / Approach:
Unqualified x inside CuriousTabDerived refers to the base subobject’s x because there is no more-derived x member. this->x and CuriousTabBase::x refer to the same base subobject member. objBase.x is the contained member’s x, independent of the base subobject.
Step-by-Step Solution:
Verification / Alternative check:
Make objBase(99) to see the last value change independently while the first three remain equal to xx.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing composition (has-a) with inheritance (is-a) and misreading qualified names.
Final Answer:
11 11 11 22
Discussion & Comments