#include<iostream.h>
#include<conio.h>
class super
{
public:
                super()
                                {
                                cout<<"Base Class Constructor Called"<<endl;
                                }
                ~super()
                                {
                                cout<<"Base Class Destructor Called"<<endl;
                                getch();
                                }
};
class sub:public super
{
public:
                sub()
                                {
                                cout<<"Child Class Constructor Called"<<endl;
                                }
                ~sub()
                                {
                                cout<<"Child Class Destructor Called"<<endl;
                                }
};
void main()
{
                clrscr();
                sub obj;
}

196.PNG

Advertisements