-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpg4.cpp
More file actions
110 lines (94 loc) · 1.33 KB
/
pg4.cpp
File metadata and controls
110 lines (94 loc) · 1.33 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include<iostream>
using namespace std;
class staff
{
public:
int code;
string name;
};
class teacher:public staff
{
public:
string sub;
void getdata(int x,string y,string z)
{
code=x;
name=y;
sub=z;
}
void display()
{
cout<<"code="<<code<<"\t"<<"name"<<name<<"\n";
cout<<"subject"<<sub<<"\n";
}
};
class typist:public staff
{
public:
int speed;
};
class officer:public staff
{
public:
char grade;
void getdata(int x,string y,char z)
{
code=x;
name=y;
grade=z;
}
void display()
{
cout<<"code="<<code<<"\t"<<"name"<<name<<"\n";
cout<<"grade"<<grade<<"\n";
}
};
class regular:public typist
{
public:
void getdata(int x,string y,int z)
{
code=x;
name=y;
speed=z;
}
void display()
{
cout<<"code="<<code<<"\t"<<"name"<<name<<"\n";
cout<<"speed"<<speed<<"\n";
}
};
class casual:public typist
{
public:
int dailywage;
void getdata(int x,string y,int z,int m)
{
code=x;
name=y;
speed=z;
dailywage=m;
}
void display()
{
cout<<"code="<<code<<"\t"<<"name"<<name<<"\n";
cout<<"speed"<<speed<<"\n";
cout<<"dailywage"<<dailywage<<"\n";
}
};
int main()
{
teacher a;
a.getdata(1,"Deba","phy");
a.display();
officer b;
b.getdata(2,"kutta",'a');
b.display();
regular c;
c.getdata(3,"lol",100);
c.display();
casual d;
d.getdata(4,"fff",120,400);
d.display();
return 0;
}