#include <iostream>
using namespace std;
class Father{
int age;
char name[10];
public:
void get();
void show();
};
void Father::get(){
cout<<"Father Name Please: "<<endl;
cin>>name;
cout<<"Father Age Please: "<<endl;
cin>>age;
}
void Father::show(){
cout<<"Father name is: "<<name<<endl;
cout<<"Father Age is: "<<age<<endl;
}
class doughter: public Father{
int age;
char name[10];
public:
void get();
void show();
};
void doughter::get(){
Father::get();
cout<<"doughter name Please: "<<endl;
cin>>name;
cout<<"doughter Age Please: "<<endl;
cin>>age;
}
void doughter::show(){
Father::show();
cout<<"doughter Name is: "<<name<<endl;
cout<<"doughter Age is: "<<age<<endl;
}
class Son: public Father{
int age;
char name[10];
public:
void get();
void show();
};
void Son::get(){
Father::get();
cout<<"Son name Please: "<<endl;
cin>>name;
cout<<"Son Age Please: "<<endl;
cin>>age;
}
void Son::show(){
Father::show();
cout<<"Son name is: "<<name<<endl;
cout<<"Son Age is: "<<age<<endl;
}
int main() {
Son s1;
doughter d1;
s1.get();
d1.get();
s1.show();
d1.show();
return 0;
}
//OUTPUT:
Father Name Please:
ABdi
Father Age Please:
56
Son name Please:
moha
Son Age Please:
23
Father Name Please:
Abdi
Father Age Please:
56
doughter name Please:
aisha
doughter Age Please:
21
Father name is: ABdi
Father Age is: 56
Son name is: moha
Son Age is: 23
Father name is: Abdi
Father Age is: 56
doughter Name is: aisha
doughter Age is: 21