Outer.hpp:
class Outer { class Inner { Inner() {} }; static Inner inner; }
Outer.cpp (at the top level, for example, not inside the function body):
Outer::Inner Outer::inner;
I get the following error:
error C2248: 'Outer::Inner::inner' : cannot access private member declared in class 'Outer::Inner'
I do not use a compiler that is fully compatible with C ++ 11 (Visual Studio 2010), so it is not possible to define a field in an ad.
source share