Program to implement the concept of “behaviour of destructor under inheritance”.

  • Post author:
  • Post category:c++
  • Post comments:0 Comments

#include
#include
class first
{
public:
~first( )
{
cout<<"n DEATH OF OBJECT OF CLASS FIRSTn";
}
};
class second : public first
{
public:
~second( )
{
cout<<"n DEATH OF OBJECT OF CLASS SECONDn" ;
}
};
class third : public second
{
public:
~third( )
{
cout<<"n DEATH OF OBJECT OF CLASS THIRDn" ;
}
};
class fourth : public third
{
public:
~fourth( )
{
cout<<"n DEATH OF OBJECT OF CLASS FOURTHn" ;
}
};
main()
{
class fourth obj;
getch();
clrscr(); }

Leave a Reply