Program to implement the concept of behaviour of constructor under inheritance.

include
#include
class first
{
public:
first()
{
cout<<"n BIRTH OF OBJECT OF CLASS FIRST" ;
}
};
class second : public first
{
public:
second()
{
cout<<"n BIRTH OF OBJECT OF CLASS SECOND" ;
}
};
class third : public second
{
public:
third()
{
cout<<"n BIRTH OF OBJECT OF CLASS THIRD" ;
}
};
class fourth : public third
{
public:
fourth()
{
cout<<"n BIRTH OF OBJECT OF CLASS FOURTH" ;
}
};
main()
{
clrscr();
class fourth obj;
getch(); }

Leave a reply