-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path27_Employeeinfo_Inheritance.cpp
More file actions
76 lines (71 loc) · 1.68 KB
/
27_Employeeinfo_Inheritance.cpp
File metadata and controls
76 lines (71 loc) · 1.68 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
#include <iostream>
using namespace std;
class EmployeeData
{
protected:
char name[30];
int age;
char gender;
public:
void GetBasicInfo(void)
{
cout << "Enter the name : ";
cin >> name;
cout << "Enter the age : ";
cin >> age;
cout << "Enter the gender : ";
cin >> gender;
}
};
class Department
{
protected:
char depname[50];
int id;
public:
void GetDepartmentInfo(void)
{
cout << "Enter the Department name : ";
cin >> depname;
cout << "Enter the employee id : ";
cin >> id;
}
};
class employee: private EmployeeData, private Department
{
public:
void GetEmployeeInfo(void)
{
cout << "Enter the employee's Basic information"<<endl;
cout << endl;
GetBasicInfo();
cout << endl;
cout << "Enter the employee's Department Information" << endl;
cout << endl;
GetDepartmentInfo();
}
void PrintEmployeeInfo(void)
{
cout << endl;
cout << "*******************************************"<<endl;
cout << endl;
cout << "Basic information" << endl;
cout << endl;
cout << "Name : " << name << endl;
cout << "Age : " << age << endl;
cout << "Gender : " << gender << endl;
cout << endl;
cout << "Department Information"<<endl;
cout << endl;
cout << "Department Name : " << depname << endl;
cout << "Employee id : " << id <<endl;
cout << endl;
cout << "*******************************************"<<endl;
}
};
int main() {
employee emp;
emp.GetEmployeeInfo();
emp.PrintEmployeeInfo();
}
//try the code at : https://repl.it/@Aravind1444/employeeinfocpp#main.cpp