"makc" <ma************@gmail.comwrote in message
news:11*********************@g4g2000hsf.googlegrou ps.com...
suppose you have a .cpp file that needs things from headers A and B,
and it is known that header A already includes B. should I still put
include B in .cpp just in case I will move some code related to B only
some day? or should I keep those countless #includes to the minimum?
what are other pros/cons?
Personally, I use header guards, and would include both A.h and B.h in my
..cpp file if I am creating a type B. It just makes it easier for
maintanance when sometime in the future I see
class B
and wonder where class B is definred. I see
#incluce "B.h"
at the top of my source, no problem, I open the file and go on my way.
Without "B.h" being defined I would have to spend extra time figuring out
what header actually included class B.