I've got a problem with a pair of classes that each refer to the other
class. I've simplified things by writing a couple dummy classes, Foo and
Bar. I've got them set up with a forward declaration for Bar, then Foo's
definition, then Bar's definition:
class Bar;
class Foo
{...};
class Bar
{...};
Each defines an enumeration. Bar contains members of its own enumeration
type (BarEnum) and Foo's enumeration type (FooEnum). Foo contains a member
that's a pointer of type Bar and a member of type FooEnum. At this point, no
problem. I've attached source files of things at this stage, it should
compile with g++ -o foo foo.cpp
But I also want to be able to use BarEnum from within Foo, and I don't know
how to make this work. I've got the lines that I used to try to do this
commented out in foo.cpp and foo.h. It's pretty clear to me why this can't
possibly work, but is there some way to make something similar work? Perhaps
a way to forward declare some of the innards of Bar?
I'm starting to think this is a) totally illegal in C++, or b) just really
bad programming.
Any help would be much appreciated!
Jessica
[Non-text portions of this message have been removed]