#include<iostream.h>
#include<conio.h>
class parent
{
public:
                parent()
                                {
                                cout<<"Parent Class Constructor"<<endl;
                                }
                virtual ~parent()
                                {
                                cout<<"Parent Class Destructor"<<endl;
                                }
};
class child:public parent
{
public:
                child()
                                {
                                cout<<"Child Class Constructor"<<endl;
                                }
                ~child()
                                {
                                cout<<"Child Class Destructor"<<endl;
                                }
};
void main()
{
                clrscr();
                parent *p=new child();
                delete p;
                getch();
}

199

Advertisements