I'm having an issue writing a class as part of a C++ program - in it I have three classes, FirstClass, SecondClass, and ThirdClass - First and Second classes both include ThirdClass.h, and in SecondClass I can declare them normally, however, in FirstClass the first declaration works fine, but any further declarations give me an error that "ThirdClass is not a type name"
here's a snippet from the class that's erroring
#include "ThirdClass.h"
class FirstClass
{
public:
FirstClass(void);
// This decleration of ThirdClass works fine
FirstClass(ThirdClass ());
FirstClass(const FirstClass& rhs);
~FirstClass(void);
private:
//These are the two that're erroring
ThirdClass nestedClass();
void Init (ThirdClass ());
void Copy (FirstClass);
};
I'm assuming that it's something to do with both of them linking to the same header file, but i've been looking far and wide trying to find a solution online to no avail. I did manage to get it working by placing the include inside a namespace, but I also read that this was very bad practice so I don't really want to do it that way.