Mail Archives: djgpp/1997/03/06/04:19:29
>How can I declare two different classes, where each class has a member
>variable of the other class type. My problem is how to get the compiler to
>recognize a variable type before it has been created.
Simple there are 2 ways of doing this, 1 declare both as being from a
related class
class catObj ....
the_cat : public catObj
// refer to owner as
catObj *owners;
... .
class the_owner : public carObj...
Or the simplest method is before you define either class, prototype
them!:
class the_cat;
class the_owner;
Have fun...
Rob Humphris
- Raw text -