/* MultiLevel Inheritence*/
#include<iostream.h>
#include<conio.h>
class Base
{
public:
void BaseClass()
{
cout<<"\n I am Base Class";
}
};
class Base1:public Base
{
public:
void BaseClass1()
{
cout<<"\n I am Base Class1";
}
};
class Derived:public Base1
{
public:
void DerivedClass()
{
cout<<"\n I am Derived Class";
}
};
main()
{
Derived d;
clrscr();
d.BaseClass();
d.BaseClass1();
d.DerivedClass();
getch();
}
#include<iostream.h>
#include<conio.h>
class Base
{
public:
void BaseClass()
{
cout<<"\n I am Base Class";
}
};
class Base1:public Base
{
public:
void BaseClass1()
{
cout<<"\n I am Base Class1";
}
};
class Derived:public Base1
{
public:
void DerivedClass()
{
cout<<"\n I am Derived Class";
}
};
main()
{
Derived d;
clrscr();
d.BaseClass();
d.BaseClass1();
d.DerivedClass();
getch();
}
No comments:
Post a Comment