Original Post
I have a problem with a parent/child object setup. I can''t get it to compile b/c I seem to run into a "chicken or egg" type argument with the header files. Let''s say my classes are declared as below. I know i must be doing something stupid, but I can''t figure out what it is. The parent class needs to know what a child class is before it can compile, but the child needs to know what a parent is before it can compile.
please help!!!
//////////////////////////////////
// Parent declaration
#include "child.hpp"
class Parent {
Parent();
~Parent();
// data
Child myChild;
};
/////////////////////////////////
// Child declaration
#include "parent.hpp"
class Child {
Child(Parent &);
~Child();
// data
Parent &myParent
};