O
Octon22
When you have several different classes that interact, how do you
avoid compile errors when doing the following:
class Person
{
City* places; // array of pointers to cities he's been to
};
class City
{
vector <Person> population; // array of houses that are within this
city
};
the compiler gets to the definition of class Person and doesn't
recognize 'City' as a class. Functions don't have this problem
because you can declare prototypes before defining the function body.
How can I solve this problem when it comes to classes? Thanks.
avoid compile errors when doing the following:
class Person
{
City* places; // array of pointers to cities he's been to
};
class City
{
vector <Person> population; // array of houses that are within this
city
};
the compiler gets to the definition of class Person and doesn't
recognize 'City' as a class. Functions don't have this problem
because you can declare prototypes before defining the function body.
How can I solve this problem when it comes to classes? Thanks.