title: Confused about the actual purpose of header files in C++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/333889/in-c-why-have-header-files-and-cpp-files">In C++ why have header files and cpp files?</a>  </p>
  </blockquote>
  
  
  
  <p>I don't quite get C++ header files, for two conflicting reasons:</p>
  
  <ol>
  <li><p>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.</p></li>
  <li><p>Why, then, are private variables of a C++ class specified in its header file?</p></li>
  </ol>
  
  <p>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. </p>
  
  <p>Maybe I'm just misunderstanding the purpose of header files, and 1. above is just completely wrong? In what ways?</p>