C
Connell Gauld
Hi,
I have what feels like a really stupid question and I'm sorry if it is
asked a lot.
Imagine I have two classes cShip and cPassenger. They each have a
definition in their own header cShip.h and cPassenger.h and their
implementation in cShip.cpp and cPassenger.cpp. Now here is the header
file for each:
#ifndef CSHIP_H
#define CSHIP_H
class cShip
{
...
cPassenger * owner;
...
};
#endif
------Next file
#ifndef CPASSENGER_H
#define CPASSENGER_H
class cPassenger
{
...
cShip * current_vehicle;
...
};
#endif
Now the problem I have is how to join these files together with includes
such that they compile. (The idea here is that a ship always has an
owner but that a passenger can be in a ship that they don't own).
Sorry if this is a really mundane question,
Connell
I have what feels like a really stupid question and I'm sorry if it is
asked a lot.
Imagine I have two classes cShip and cPassenger. They each have a
definition in their own header cShip.h and cPassenger.h and their
implementation in cShip.cpp and cPassenger.cpp. Now here is the header
file for each:
#ifndef CSHIP_H
#define CSHIP_H
class cShip
{
...
cPassenger * owner;
...
};
#endif
------Next file
#ifndef CPASSENGER_H
#define CPASSENGER_H
class cPassenger
{
...
cShip * current_vehicle;
...
};
#endif
Now the problem I have is how to join these files together with includes
such that they compile. (The idea here is that a ship always has an
owner but that a passenger can be in a ship that they don't own).
Sorry if this is a really mundane question,
Connell