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
71
72
73
74
75
76
77
78
79
#include <iostream>
 
using namespace std;
class A
{
public:
    A()
    {
        cout << "A생성" << endl;
    }
    ~A()
    {
        cout << "A파괴" << endl;
    }
    void P()
    {
        cout << "함수A-P" << endl;
    }
};
class B : public A
{
public:
    B()
    {
        cout << "-B생성" << endl;
    }
    ~B()
    {
        cout << "-B파괴" << endl;
    }
    void P()
    {
        cout << "함수B-P" << endl;
    }
    void Q()
    {
        cout << "함수B-Q" << endl;
    }
    void F()
    {
        cout << "함수F" << endl;
        P();
    }
    void G()
    {
        cout << "함수G" << endl;
        Q();
    }
};
class C : public B
{
public:
    C()
    {
        cout << "--C생성" << endl;
    }
    ~C()
    {
        cout << "--C파괴" << endl;
    }
    void P()
    {
        cout << "함수 C-P" << endl;
    }
    void Q()
    {
        cout << "함수 C-Q" << endl;
    }
};
 
int main()
{
    cout << "객체 C 생성" << endl;
    C test;
    cout << "C객체 F함수 호출" << endl;
    test.F();
 
    return 0;
}
cs


걍 직접 해보는거 어렵지않잖음

해보면되지..