#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()
{
cout<<"Enter y: ";
cin>>y;
}
void showB()
{
cout<<"Y = "<<y<<endl;
}
};
void main()
{
clrscr();
B b;
b.getA();
b.getB();
b.showA();
b.showB();
getch();
}
No comments:
Post a Comment