title: C++ Using a Class Within a Class
body: <p>I have a basic question that has bothered me for sometime.</p>
  
  <p>When using a Class within a Class I can define the header of the Class I want to use in the header file. I have seen two ways of doing this and would like to know the difference between the two methods?</p>
  
  <p>ex1</p>
  
  <pre><code>#include "ClassA.h"
  
  class ClassB {
  
     public:
       ClassB();
       ~ClassB();
       ClassA* a;
  };
  #endif
  </code></pre>
  
  <p>ex2 Here is the other way of doing it. The ClassA Header would be defined in ClassB source file.</p>
  
  <pre><code>class ClassA;
  
  class ClassB {
  
     public:
       ClassB();
       ~ClassB();
       ClassA* a;
  };
  #endif
  </code></pre>
  
  <p>What are the differences with these two methods?</p>