-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLab 06 Task 4.cpp
82 lines (78 loc) · 1.35 KB
/
Lab 06 Task 4.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include<iostream>
#include<string>
using namespace std;
class Person{
private:
int age;
protected:
string name;
public:
Person(){
age=10;
name="Ali";
}
void set_age(int a){
age=a;
}
int get_age(){
return age;
}
};
class Employee{
private:
int empid;
protected:
float salary;
public:
Employee(){
empid=101;
salary=5000;
}
void set_empid(int b){
empid=b;
}
int get_empid(){
return empid;
}
};
class Manager:public Person,public Employee{
private:
string type;
public:
Manager(){
type="ABC";
}
void set_type(string c){
type=c;
}
string get_type(){
return type;
}
};
class ITManager:public Manager{
private:
int no_of_persons;
public:
ITManager(int a, string b, int c, float d, string e, int f){
set_age(a);
name=b;
set_empid(c);
salary=d;
set_type(e);
no_of_persons=f;
}
void display(){
cout<<"\t\t\t\t\tDISPLAY FUNCTION CALLED"<<endl;
cout<<"Age: "<<get_age()<<endl;
cout<<"Name: "<<name<<endl;
cout<<"Employee ID: "<<get_empid()<<endl;
cout<<"Salary: "<<salary<<endl;
cout<<"Type: "<<get_type()<<endl;
cout<<"Number of persons: "<<no_of_persons;
}
};
int main(){
ITManager ob1(20, "Zain Kizilbash", 4675,25000,"Programmer",10);
ob1.display();
return 0;
}