-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht11.cpp
More file actions
47 lines (41 loc) · 728 Bytes
/
Copy patht11.cpp
File metadata and controls
47 lines (41 loc) · 728 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
/* multiple inheritance*/
#include <iostream>
using namespace std;
class Base1
{
protected:
int baseint1;
public:
void setbase1(int a)
{
baseint1 = a;
}
};
class Base2
{
protected:
int baseint2;
public:
void setbase2(int a)
{
baseint2 = a;
}
};
class derived : public Base1, public Base2
{
public:
void show()
{
cout << "the value of base1" << baseint1 << endl;
cout << "the value of base2" << baseint2 << endl;
cout << "the sum of value is" << baseint1 + baseint2 << endl;
}
};
int main()
{
derived durva;
durva.setbase1(34);
durva.setbase2(45);
durva.show();
return 0;
}