Possible Duplicate:
In C++ why have header files and cpp files?
I don't quite get C++ header files, for two conflicting reasons:
I thought the purpose of header files was in general to separate interface and implementation. In other words, the client uses the header file to learn how to use the class, but doesn't have to worry about how the class actually implements this functionality internally.
Why, then, are private variables of a C++ class specified in its header file?
It seems to me that having private variables in the header file violate the separation of interface and implementation. Intuitively, I would think it would make more sense for private variables to be in the source file, since this is the file that is not exposed to the outside world.
Maybe I'm just misunderstanding the purpose of header files, and 1. above is just completely wrong? In what ways?