No, actually they won't have access. (I think there's a defect report about that.)
Note that inner classes in C++ are like static inner classes in Java, i.e. you don't need an instance of the outer class to create them, but they can't refer to non-static members of the outer class without a concrete instance.
To simulate Java's static inner classes, you have to do this:
Code:
class Outer
{
class Inner;
friend class Inner;
class Inner
{
// Actual definition
};
};
To simulate non-static inner classes is a bit more effort.
Code:
class Outer
{
class Inner;
friend class Inner;
class Inner
{
Outer *outer;
Inner(Outer *o) : outer(o) {}
};
};
You need to explicitly pass the outer object to the constructor of the inner one. You can then refer to properties of the outer object through the pointer in the inner one.