← Quiz: Multiple Inheritance and the Diamond Problem: all 10 questions
Quiz: Multiple Inheritance and the Diamond Problem · Question 3 of 10
Both bases of a class define status(). What happens when you call obj.status() without overriding it?
Both bases of a class define status(). What happens when you call obj.status() without overriding it?
- A.The first base's version is used
- B.The last base's version is used
- C.Compile error: the call is ambiguous
- D.Both versions run
Answer & explanation
Correct answer: Compile error: the call is ambiguous
The compiler refuses to guess; use obj.Base::status() or override status() in the derived class.
Can you get the rest right without peeking?
Take the timed Quiz: Multiple Inheritance and the Diamond Problem quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →