title: Why use #ifndef CLASS_H and #define CLASS_H in .h file but not in .cpp?
body: <p>I have always seen people write</p>
  
  <p>class.h</p>
  
  <pre><code>#ifndef CLASS_H
  #define CLASS_H
  
  //blah blah blah
  
  #endif
  </code></pre>
  
  <p>The question is, why don't they also do that for the .cpp file that contain definitions for class functions?</p>
  
  <p>Let's say I have  <code>main.cpp</code>, and <code>main.cpp</code> includes <code>class.h</code>. The <code>class.h</code> file does not <code>include</code> anything, so how does <code>main.cpp</code> know what is in the <code>class.cpp</code>?</p>