← Quiz: Inheritance and Virtual Functions: all 10 questions
Quiz: Inheritance and Virtual Functions · Question 8 of 10
In what order do destructors run when a Derived object is destroyed?
In what order do destructors run when a Derived object is destroyed?
- A.Base first, then Derived
- B.Derived first, then Base
- C.Only the Derived destructor runs
- D.The order is not defined
Answer & explanation
Correct answer: Derived first, then Base
Destruction is the reverse of construction: the derived part is cleaned up before the base it was built on.
Can you get the rest right without peeking?
Take the timed Quiz: Inheritance and Virtual Functions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →