-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhybridex.cpp
61 lines (61 loc) · 920 Bytes
/
hybridex.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 grandmother
{
protected:
string name="Maya Rani Khare";
public:
void show12()
{
cout<<"Name of the grandmother is "<<name<<endl;
}
};
class father: virtual public grandmother
{
protected:
string name="Raj Khare";
public:
void show1()
{
cout<<"Name of the father is "<<name<<endl;
}
};
class mother: public virtual grandmother
{
protected:
string name="Shivanee Kanchan";
public:
void show2()
{
cout<<"Name of the mother is "<<name<<endl;
}
};
class child: public mother,public father
{
protected:
string name;
public:
child(string c)
{
name=c;
}
void show()
{
show12();
show1();
show2();
cout<<"Name of the child is "<<name<<endl;
}
};
int main()
{
cout<<"Code for hybrid level"<<endl;
child nish("Nishkarsh Raj");
nish.show();
cout<<"\n\n\n\n";
cout<<sizeof(grandmother)<<endl;
cout<<sizeof(father)<<endl;
cout<<sizeof(mother)<<endl;
cout<<sizeof(child)<<endl;
return 0;
}