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
#include <iostream>
 
 
using namespace std;
 
class A
{
public:
    int _a;
    A(int a) : _a(a)
     {
 
    }
};
 
class B : public A
{
public:
 
    int _b;
    B(int a, int b) : A(a),_b(b)
    {
 
    }
};
 
class C : public B
{
public:
    int _c;
    C(int a, int b, int c) : B(a, b), _c(c)
    {
 
    }
 
    void PrintAll()
    {
        cout << _a << endl;
        cout << _b << endl;
        cout << _c << endl;
    }
};
 
int main(void)
{
    C* c = new C(123);
    c->PrintAll();
}
 
cs


C에서 A로 다이렉트로 못감

그래서 C에서 B 생성자를 불러오고

다시 B에서 A생성자를 불러오는 식으로 해야함