🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Base first, then Derived
  2. B.Derived first, then Base
  3. C.Only the Derived destructor runs
  4. 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 →