E
Erik Bongers
Hi,
Nested classes only seem to be able to access static members of the
surrounding class :
class SurroundingClass
{
public:
class InnerClass
{
public:
void setSurroundingVariable()
{
SurroundingClass::variable = 4;
}
};
friend class InnerClass;
static int variable;
// int variable; --> ERROR : SurroundClass is not a base class
for type InnerClass
};
I would like to be able to access *instance* members of the
SurroundingClass, rather than only *static* members from within the
InnerClass.
I don't really understand why this is not working.
Perhaps I don't understand the concept of nested classes...
Anyone able to explain, and provide a solution for this problem.
Thanks in advance !
Erik Bongers.
Nested classes only seem to be able to access static members of the
surrounding class :
class SurroundingClass
{
public:
class InnerClass
{
public:
void setSurroundingVariable()
{
SurroundingClass::variable = 4;
}
};
friend class InnerClass;
static int variable;
// int variable; --> ERROR : SurroundClass is not a base class
for type InnerClass
};
I would like to be able to access *instance* members of the
SurroundingClass, rather than only *static* members from within the
InnerClass.
I don't really understand why this is not working.
Perhaps I don't understand the concept of nested classes...
Anyone able to explain, and provide a solution for this problem.
Thanks in advance !
Erik Bongers.