Difficulty: Easy
Correct Answer: Correct — they are distinct concepts; multiple ≠ multilevel.
Explanation:
Introduction / Context:
This question differentiates two foundational inheritance patterns: multiple inheritance and multilevel inheritance. Understanding the difference is vital when modeling type hierarchies and predicting method lookup and data layout behavior.
Given Data / Assumptions:
Concept / Approach:
In multiple inheritance, a single class derives from two or more bases, e.g., class D : public B1, public B2 { }; In multilevel inheritance, each class derives from at most one immediate base, but across levels: A → B → C. These notions address orthogonal structure: breadth (multiple) vs depth (multilevel). Confusing them can lead to mistaken assumptions about diamond problems and virtual inheritance — issues specifically relevant to multiple inheritance, not multilevel per se.
Step-by-Step Solution:
Verification / Alternative check:
Draw both diagrams and observe that multilevel never has two parents at the same level for a class, while multiple always does for the derived class in question.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming “more than one level” implies “more than one base”; or thinking that multilevel inherently causes diamond problems (it does not).
Final Answer:
Correct — they are distinct concepts; multiple ≠ multilevel.
Discussion & Comments