#include<iostream.h>
#include<constream.h>
class A1
{
protected:
char name[15];
int age;
};
class A2: public A1
{
protected:
float height;
float weight;
};
class A3: public A2
{
protected:
char sex;
public:
void get()
{
cout<<"name :";
cin>>name;
cout<<"age :"; cin>>age;
cout<<"sex :"; cin>>sex;
cout<<"height :"; cin>>height;
cout<<"weight :"; cin>>weight;
}
void show()
{
cout<<"\n Name :"<<name;
cout<<"\Age :"<<age<<"years";
cout<<"\Sex :"<<sex;
cout<<"\Height :"<<height<<"feets";
cout<<"\Weight :"<<weight<<"kg.";
}
};
void main()
{
clrscr();
A3 X;
X.get();
X.show();
getch();
}
No comments:
Post a Comment