I'm having trouble implementing a nested class who's constructor is initialized with some of the enclosing class' private data members.
Example:
Header File:
class Enclosing {
//...Public members
//...Private members
int x, int y
class Inner; // Declaration for nested class
};
Impl. File:
// Stuff...
class Enclosing::Inner {
explicit Inner() : foo(x), bar(y) // foo and bar are data members of Inner
//...
};
I get an invalid use of non-static data member
error. Is there something I'm missing when it comes to nested class access to its enclosing class' members?