Possible Duplicate:
Forward declaration of nested types/classes in C++
For simple cross-references of classes it is feasable to predeclare the classnames and use it as reference. In this way the representation is a pointer. But in case I want to cross-reference a nested class of both (look at the example below), I will run into trouble, because there seems to be no way to predeclare a nested class.
So my question is: Is there a way to predeclare nested classes so that my example could work?
If not: Is there a common workaround for that, that doesn't uglyfy the code too much?
// Need to predeclare it to use it inside 'First'
class Second;
class Second::Nested; // Wrong
// Definition for my 'First' class
class First
{
public:
Second::Nested* sested; // I need to use the nested class of the 'Second' class.
// Therefore I need to predeclare the nested class.
class Nested { };
};
// Definition for my 'Second' class
class Second
{
public:
First::Nested* fested; // I need to use the nested class of the 'First' class.
// This is okay.
class Nested { };
};