-
Notifications
You must be signed in to change notification settings - Fork 0
/
44.cpp
71 lines (64 loc) · 1.46 KB
/
44.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
#include <iostream>
using namespace std;
class Person{
protected:
char name[30];
int age;
char address[50];
public:
void getData()
{
// cout << "Base" << endl;
cout << "Enter Name, Age and Address" << endl;
cin >> name >> age >> address;
}
void showData()
{
cout << "Name : " << name << endl;
cout << "Age : " << age << endl;
cout << "Address : " << address << endl;
}
};
class Student : public Person
{
char usn[10];
char college[20];
public:
void getStudData()
{
// cout << "Child" << endl;
getData();
cout << "Enter USN and College" << endl;
cin >> usn >> college;
}
void showStudData()
{
showData();
cout << "USN : " << usn << endl;
cout << "College : " << college << endl;
}
};
class Employee : public Person{
char empid[10];
char company[20];
public:
void getEmpData()
{
getData();
cout << "Enter Employee ID and Company" << endl;
cin >> empid >> company;
}
void showStudData()
{
showData();
cout << "EmpID : " << empid << endl;
cout << "Company : " << company << endl;
}
};
int main()
{
Student s1;
s1.getStudData();
s1.showStudData();
return 0;
}