-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinheritance.cpp
66 lines (64 loc) · 907 Bytes
/
inheritance.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<iostream>
#include<conio.h>
using namespace std;
class worker
{
int age;
char name[20];
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<<"ln my name is: "<<name<<"in my age is: "<<age;
}
class manager: public worker
{
int name ;
public:
void get();
void show();
};
void manager::get()
{
worker::get ();
cout<<"no. of workers under you: "<<endl;
cin>>name;
}
void manager::show()
{
worker::show ();
cout<<" no. of workers under me are: "<<name;
}
class ceo: public manager
{
int nom;
public:
void get();
void show();
};
void ceo::get()
{
manager::get();
cout<<"no. of managers under you are: "<<endl;
cin>>nom;
}
void ceo::show()
{
cout<<" the no of managers under me are: "<<endl;
cout<<nom;
}
main()
{
ceo cl;
cl.get();
cl.show();
}