What is the order of construction and destruction of objects in an inheritance hierarchy?

Last updated 21 June 2026

  • Construction goes base-to-derived: base constructors (in declaration order of bases), then members (in declaration order, not initializer-list order), then the derived body.

  • Destruction runs in exactly the reverse order, derived-to-base.

  • Deleting via a base pointer needs a virtual destructor (otherwise undefined behavior). Virtual calls inside a base constructor resolve to the base version.

  • https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/cpp/destructors-cpp.md
All C++ interview questions