#include <iostream>
using namespace std;
class worker{
int age;
char name[10];
public:
void get();
void show();
};
void worker::get(){
cout<<"Your Name Please: "<<endl;
cin>>name;
cout<<"Your Age Please: "<<endl;
cin>>age;
}
void worker::show(){
cout<<"My name is: "<<name<<endl;
cout<<"My Age is: "<<age<<endl;
}
class manager:public worker{
int now;
public:
void get();
void show();
};
void manager::get(){
worker::get();
cout<<"Num of workers are: "<<endl;
cin>>now;
}
void manager::show(){
worker::show();
cout<<"Num of workers are: "<<now<<endl;
}
class ceo: public manager{
int nom;
public:
void get();
void show();
void print();
};
void ceo::get(){
manager::get();
cout<<"Num of managers are: "<<endl;
cin>>nom;
}
void ceo::show(){
manager::show();
cout<<"Num of managers are: "<<nom<<endl;
}
int main() {
worker w1;
manager m1;
ceo c1;
c1.get();
c1.show();
return 0;
}
//OUTPUT:
Your Name Please:
moha
Your Age Please:
45
Num of workers are:
787
Num of managers are:
897
My name is: moha
My Age is: 45
Num of workers are: 787
Num of managers are: 897
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter