RESOLVED
Sorry for all the confusion - I'll try harder to ask better questions in the future!
My original question was basically whether or not it was possible to create an instance of a class before the class was defined.
I've looked around a lot for this and I haven't really found a solution.
Basically, I want to be able to do this:namespace a { class first { private: second s; //Throws an error } class second { private: first f; //Seems to work } }
But it doesn't work. Even when I specify
a::second
, it doesn't recognize them.So is it possible to access members of the same namespace before they are declared in that namespace? If so, how?
I've since figured it out, and the answer is that no, you cannot create instances of a class before it's declared, but you can forward-declare the class and create a pointer to it.