#include<iostream.h>
#include<conio.h>
class A
{
private:
int x;
public:
void getA()
{
cout<<"Enter x: ";
cin>>x;
}
void showA()
{
cout<<"X = "<<x<<endl;
}
};
class B : public A
{
private:
int y;
public:
void getB()
{
getA();
cout<<"Enter y: ";
cin>>y;
}
void showB()
{
showA();
cout<<"Y = "<<y<<endl;
}
};
class C : public B
{
public:
void getC()
{
getB();
}
void showC()
{
showB();
}
};
void main()
{
clrscr();
C obj;
obj.getC();
obj.showC();
getch();
}
No comments:
Post a Comment