Mail Archives: djgpp/1997/03/07/02:18:43
Graham Howard Wile <an118 AT chebucto DOT ns DOT ca> wrote in article
<5fl6a5$4ic AT News DOT Dal DOT Ca>...
>
> 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.
>
Try jusr declaring the other class first, but defining it later. Like..
class the_owner;
class the_cat
{
private:
int its_age, its_weight;
char *fur_color;
the_owner its_owners[3];
...
}
class the_owner
{
private:
the_cat cats_owned[5];
...
}
Hope this helps.
--
TTFN
Sly (Steve)
sly AT aussie DOT net
- Raw text -