Write a program to show the execution of constructor and destructor in case of multiple inheritance. Also show the output

How to write this program-:

since it is multiple inheritance, so make 2 base classes and 1 derived class.

we need to show the constructor and destructor invocation, so create constructors and destructors and enter some information within them.

eg-: cout<<“this is base class constructor”;

From the int main function, use the method of calling constructors

http://www.scitechtop.com/write-a-c-program-showing-the-uses-of-constructorsdestructors-with-theory/

[read from here]

or just create a derived class object and done.

Output-:

 Base1 class constructor

Base2 class constructor

derived class constructor

derived class destructor

Base2 class destructor

Base1 class destructor

 

Motivation for today!

Be the first to comment

Leave a Reply

Your email address will not be published.


*