
실시간댓글
|
|
누난널해치지않아 | 2014-06-18 11:09
1 #include <iostream>
2
3 class X
4 {
5 protected:
6 int x;
7 };
8
9 class Y : public X
10 {
11
12 };
13
14 class Z : public X
15 {
16 Y y;
17
18 public:
19 void Print() { printf("%d\n", y.x); }
20 };
21
22 int main(int argc, char** args)
23 {
24 Z z;
25
26 z.Print();
27
28 return 0;
29 }
int X::x 요 놈은 Y, Z 모두 쓰는 놈이고
Z와 Y는 서로의 x에 액세스 할 수 없게 만들고 싶은데 가능?
누난널해치지않아
0
57,760
프로필 숨기기
55%