Thread: compiling error
View Single Post
Old Oct 30th, 2006, 3:11 AM   #25
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 824
Rep Power: 4 The Dark is on a distinguished road
Don't include Screen.h, Rectangle.h or iostream.h inside point.h
You also don't need to forward declare Rectangle inside point.h, as it doesn't use it.

Screen.h doesn't need to include Point.h, Rectangle.h or iostream.h, it just needs the forward declare of Point (or you could just leave the Point.h include in there, but you don't need the include and the forward declare).

Rectangle just needs to include Point.h and have the forward declare of Screen. All the other includes should be removed.

As a rule of thumb, the fewer nested includes you have the better. If the header doesn't need the include, then don't put it in the header.
The Dark is offline   Reply With Quote