Base Class Constructor and Destructor
IIn this lesson, we'll learn how constructors and destructors are called in derived and base classes during inheritance.
We'll cover the following
Base Class Constructor
When we make an instance of the Derived
class without parameters it will first call the default constructor of the Base
class and then the Derived
class. In the same way, when we call the parameterized constructor of the derived class, it will first call the parameterized constructor of the Base
class and then Derived
class.
The following code explains how this is done: