-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathInheritance.cpp
62 lines (61 loc) · 1.23 KB
/
Inheritance.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
#include<iostream>
using namespace std;
class WWE
{
int serial;
public:
string name;
float salary;
WWE()
{
serial=1;
name="Finn Balor";
salary=40000;
}
void insert()
{
cout<<"Make the entries of the superstar"<<endl;
cout<<"Enter the serial number of the superstar ";
cin>>serial;
cout<<endl;
cout<<"Enter the name of the superstar ";
cin>>name;
cout<<endl;
cout<<"Enter the salary of the superstar ";
cin>>salary;
cout<<endl;
}
void show()
{
cout<<"Name of the superstar is "<<name<<endl<<"Serial of the superstar "<<serial<<endl<<"Salary of the superstar "<<salary<<endl;
}
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
class record:public WWE
{
string sex;
public:
record()
{
sex="male";
}
void show1()
{
cout<<"Name of the superstar is "<<name<<endl;
cout<<"Win/Loss Record of the Superstar is 80 wins to 6 losses "<<endl;
cout<<"Salary of the superstar is "<<salary<<endl;
cout<<"Sex of the superstar is "<<sex<<endl;
}
};
///////////////////////////////////////////////////////////////////////////////////////////////////
int main()
{
cout<<"Hello! This is a program depicting Inheritance"<<endl;
WWE nish;
nish.show();
nish.insert();
nish.show();
record nish1;
nish1.show1();
return 0;
}