-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultiple inheritence.cpp
54 lines (48 loc) · 1.01 KB
/
Multiple inheritence.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
#include <iostream>
#include<string>
using namespace std;
class father{
public:
int height;
void askfather()
{
cout<<"I am your father ask me what you want from myside"<<endl;
}
};
class Mother{
public:
string skincolour;
void askmother()
{
cout<<"I am your mother ask me what you want from myside"<<endl;
}
};
class child:public father,public Mother{
public:
void askparents()
{
cout<<"I am aking my details from my parents"<<endl;
}
void setcolor(string icolour)
{
skincolour=icolour;
}
void setheight(int iheight)
{
height=iheight;
}
void display()
{
cout<<"Height is "<< height <<"and skin colour is "<< skincolour <<endl;
}
};
int main()
{
child Amartyapandey;
Amartyapandey.setcolor("fair");
Amartyapandey.setheight(6);
Amartyapandey.display();
Amartyapandey.askfather();
Amartyapandey.askmother();
return 0;
}