-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path30-multiple_inheritance.cpp
More file actions
70 lines (67 loc) · 918 Bytes
/
Copy path30-multiple_inheritance.cpp
File metadata and controls
70 lines (67 loc) · 918 Bytes
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
//deriving publicly
#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
class B;
class A
{
int a;
public:
void get_a(int x)
{
a=x;
}
int show_a(void)
{
return a;
}
void display()
{
cout<<"this is class A\n";
}
};
class B
{
int b;
public:
void get_b(int x)
{
b=x;
}
int show_b(void)
{
return b;
}
void display()
{
cout<<"this is class B\n";
}
};
class mul :public A,public B
{
public:
int multiply;
int multi()
{
multiply=show_a()*show_b();
return multiply;
}
void display()
{
cout<<"this is class mul\n";
}
};
int main()
{
mul ob;
ob.get_a(10);
ob.get_b(20);
cout<<ob.multi()<<endl;
ob.display();
ob.A::display();
ob.B::display();
ob.mul::display();
getch();
return 0;
}