/* Order Of Execution */
#include<iostream.h>
#include<conio.h>
class Base
{
public:
Base()
{
cout<<"\n I am Base Class Constructor";
}
~Base()
{
cout<<"\n I am Base Class Destructor";
}
};
class Derived:public Base
{
public:
Derived()
{
cout<<"\n I am Derived Class Constructor";
}
~Derived()
{
cout<<"\n I am Derived Class Destructor";
}
};
class Derived1:public Derived
{
public:
Derived1()
{
cout<<"\n I am Derived1 Class Constructor";
}
~Derived1()
{
cout<<"\n I am Derived1 Class Destructor";
}
};
void main()
{
clrscr();
Derived1 d;
getch();
}
#include<iostream.h>
#include<conio.h>
class Base
{
public:
Base()
{
cout<<"\n I am Base Class Constructor";
}
~Base()
{
cout<<"\n I am Base Class Destructor";
}
};
class Derived:public Base
{
public:
Derived()
{
cout<<"\n I am Derived Class Constructor";
}
~Derived()
{
cout<<"\n I am Derived Class Destructor";
}
};
class Derived1:public Derived
{
public:
Derived1()
{
cout<<"\n I am Derived1 Class Constructor";
}
~Derived1()
{
cout<<"\n I am Derived1 Class Destructor";
}
};
void main()
{
clrscr();
Derived1 d;
getch();
}
No comments:
Post a Comment