Order of Destruction

When an object goes out of scope or is deleted, the sequence of events in its complete destruction is as follows:

  1. The class’s destructor is called, and the body of the destructor function is executed.

  2. Destructors for nonstatic member objects are called in the reverse order in which they appear in the class declaration. The optional member initialization list used in construction of these members does not affect the order of construction or destruction. (For more information about initializing members, see Initializing Bases and Members.)

  3. Destructors for nonvirtual base classes are called in the reverse order of declaration.

  4. Destructors for virtual base classes are called in the reverse order of declaration.