-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path35.cpp
58 lines (44 loc) · 1.12 KB
/
35.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
#include <iostream>
using namespace std;
class ParentA {
public:
int _value;
int _value1;
ParentA(int value, int value1)
: _value(value), _value1(value1) {}
void Print() {
cout << "ParentA::_value = " << _value << endl;
cout << "ParentA::_value1 = " << _value1 << endl;
}
};
class ParentB {
public:
int _value;
int _value2;
ParentB(int value, int value2)
: _value(value), _value2(value2) {}
void Print() {
cout << "ParentB::_value = " << _value << endl;
}
};
class ParentC {
public:
int _value;
int _value3;
ParentC(int value, int value3)
: _value(value), _value3(value3) {}
void Print() {
cout << "ParentC::_value = " << _value << endl;
cout << "ParentC::_value3 = " << _value3 << endl;
}
};
class ChildD : public ParentA, public ParentB, public ParentC {
public:
ChildD(int valueA, int valueA1, int valueB, int valueB1, int valueC, int valueC1)
: ParentA(valueA, valueA1), ParentB(valueB, valueB1), ParentC(valueC, valueC1) {}
};
int main() {
ChildD childd(1, 10, 2, 20, 3, 30);
childd.ParentC::Print();
return 0;
}