내가이 일을하려고했던,A의 클래스 수준의 액세스 외부 클래스의 데이터 멤버
위class Outer {
public:
struct inner_t {
void foo()
{
printf("%d", _x);
}
};
int _x;
};
int main()
{
Outer o;
o._x = 10;
}
오류로 컴파일 할 수 없습니다 :
error: invalid use of non-static data member ‘Outer::_x’
그러나 따라 this post, inner_t
에 실제로 Outer::_x
에 액세스 할 수 있습니다. 무엇이 잘못 되었나요?
Shoot, stupid me, :-). – Alcott