title: Access Derived Class When Only Base Class Header is Included
body: <p>I'm trying to understand if there is a way set an include directive for a base class but also be able to access derived classes that are defined in a different header than the base class. For instance:</p>
  
  <p>In GenericObject.h:</p>
  
  <pre><code>class GenericObject { 
      /* whatever - shared properties and methods implemented in .cpp file */ 
  }
  </code></pre>
  
  <p>In Ball.h:</p>
  
  <pre><code>class Ball : public GenericObject { 
      /* whatever - implementation details are in the .cpp file */
  }
  </code></pre>
  
  <p>Now in some other implementation file (let's call it the main.cpp), I have <code>#include</code>d <code>"GenericObject.h"</code>. In main.cpp, I want to be able to access both the members of the GenericObject class as well as the Ball class and any other derived class of GenericObject. From my trials so far, the compiler won't recognize the Ball identifier if I try to declare it like <code>Ball * b;</code> and thus any of the members that belong to its class.</p>
  
  <p>Is this because my <code>#include</code>'d <code>"GenericObject.h"</code> file is not also linking that there is this derived Ball class for me to access? I can correctly ID and use the Ball class if I <code>"#include "Ball.h"</code> but I can't imagine I should include all of the header files of derived classes of the GenericObject class, right?</p>
  
  <p>If I had to take a guess at how this might work, I'd guess that something like a prototype declaration for the Ball class inside the GenericObject class would be a step in the right direction but I'm not sure if a class prototype is even a thing.</p>
  
  <p>Thanks for reading and any feedback everyone!</p>