1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
using namespace std;
 
class SuperA {
    int x = 10;
public:
    void print() {
        cout << x << endl;
    }
};
 
int main()
{
    SuperA A;
    A.print();
    return 0;
}
cs




이렇게 짜면 SuperA의 객체가 만들어지지 않았기에 초기화 안된다고 하지않았나요 ?


실험삼아 해봤는데 10이 출력되네요.... 뭐죠 ....