-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathprogram 10 oops.cpp
More file actions
52 lines (47 loc) · 973 Bytes
/
program 10 oops.cpp
File metadata and controls
52 lines (47 loc) · 973 Bytes
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
#include<iostream>
using namespace std;
class employee{
char name[50];
float salary;
public:
void get();
void display();
};
void employee:: get(){
cout<<"Name of the Employee : "<<endl;
cin>>name;
cout<<"Salary of the Employee : "<<endl;
cin>>salary;
}
void employee:: display(){
cout<<"Name = "<<name<<endl;
cout<<"Salary = "<<salary<<endl;
}
class manager : public employee{
char dept[30];
public:
void get();
void tostring();
};
void manager:: get(){
employee::get();
cout<<"Department of the employee : "<<endl;
cin>>dept;
}
void manager:: tostring(){
employee::display();
cout<<"Department : "<<dept<<endl;
}
class executive: public manager{
public:
void tostring(){
cout<<"Executive : "<<endl;
manager::tostring();
}
};
int main(){
executive emp;
emp.get();
emp.tostring();
return 0;
}