In the previous example, you saw how a constructor called a method for a class. But how? That object wasn’t created yet… right?
Well sort of.
When you build from a base/parent class, it’s no arg constructor is called first, creating a base class. That object is then able to call it’s functions.
Let’s try putting some cout statements into the constructors to see the workflow of how objects are created.
Note: Destructors work very similarly. Except in reverse, calling the child class’s destructor, then the parent class’s.
Understanding Constructor and Destructor Chaining was originally found on Access 2 Learn