#include<iostream.h>
#include<conio.h>
class base1
{
public:
base1()
{
cout<<"Inside base1 constructor"<<endl;
}
~base1()
{
cout<<"Inside base1 destructor"<<endl;
}
};//end of base class
class base2
{
public:
base2()
{
cout<<"Inside base2 constructor"<<endl;
}
~base2()
{
cout<<"Inside base2 destructor"<<endl;
}
};//end of derived class
class derived : public base1,public base2
{
public:
derived()
{
cout<<"Inside derived constructor"<<endl;
}
~derived()
{
cout<<"Inside derived destructor"<<endl;
}
};//end of derived class
void main()
{
clrscr();
derived obj;
}
/*
Inside base1 constructor
Inside base2 constructor
Inside derived constructor
Inside derived destructor
Inside base2 destructor
Inside base1 destructor
*/
0 comments:
Post a Comment