Including Header Files - Urgent help needed
Posted on 2005-04-02
I have a main class, MainClass.h, and another class, Dog.h. MainClass.h has included Dog.h (#include "Dog.h") and creates instances of that class.
My problem is that i want to be able to access the MainClass object from the Dog, but i dont want to inheirited. I want to store a pointer to MainClass inside Dog, but when i do this i get errors.
If i remove the #include "Dog.h" in the MainClass it compiles ok. I think it is because if there are the 2 includes in both the classes, then there is some kind of problem.
I am using #ifndef and #define but it still doesnt resolve my issue.
How can i have a pointer to the MainClass object from the Dog class?