Normally I only put in the .h file what is necessary to include there if I need to include that file in other source files (stuff which wants to use what is in test.cpp).
That way, I don't have to figure out all of the dependencies of test.h just to be able to use it.
If for example I have
Code:
#ifndef _TEST_HEADER_
#define _TEST_HEADER_
#include <string>
void myfunc ( std::string param );
#endif
Then I would only need <string> in there, and not windows.h.
I shouldn't need to know (or care) that test.cpp needs windows.h, since it will include it if it needs to.
I certainly don't want the excess baggage of windows.h just to be able to call a function in test.cpp
Some people go to the other extreme of not having ANY include files in include files, and exposing the entire set of dependencies in every source file. This creates it's own maintenance problem of updating everywhere a file gets included should its dependencies change.
It really depends how you value your traceability.
So there you have it
- include everything the .cpp also needs
- include only what's necessary for the header itself
- include nothing