Single Inheritance

#include<iostream.h>
#include<constream.h>
class ABC
 {
protected:
     char name[15];
          int age;
 };
class abc: public ABC
 {
Protected:
     float height;
     float weight;
public:
  void getdata()
   {
cout<<"\n Enter Name and Age:";
cin>>name>>age;
cout<<"\n Enter Height and Weight:";
cin>>height>>weight;
   }
  void show()
   {
cout<<"\n Name:"<<name<<"\n Age:"<<age<<"years";
cout<<"\n Height:"<<height<<"feets";    
cout<<”\n weight:"<<weight<<"kg";
   }
 };
void main()
 {
clrscr();
abc x;
x.getdata();
x.show();
getch();
 }

No comments:

Related Posts with Thumbnails