what you're talking about sounds like forward declarations to me, but I'm not sure. If so, this is what a forward declaration is. Say that you have a class called CCar, and it will have a pointer to a CSteeringWheel object. Your class may look something like this:
class CCar
{
//other code ...
CSteeringWheel * pSW;
}
if you don't put a forward declaration for this before your class, your program won't compile. It looks like this with the forward declaration:
class CSteeringWheel;
class CCar
{
//other code ...
CSteeringWheel * pSW;
}
this lets the compiler know that pSW is a pointer to a class object, so don't worry about it. In your Car.cpp file you will do an '#include SteeringWheel.h', so everything will work out right. Of course, you could have just put the previous include statement in your Car.h file, but then it would be included in every place that your CCar class definition was, which you might not want. Note that forward declarations only work with pointers. If you had wanted to use an actual instance instead of a pointer, you would have had to #include SteeringWheel.h in Car.h
bdiamond