title: C++ Access derived class member from base class pointer
body: <p>If I allocate an object of a class <code>Derived</code> (with a base class of <code>Base</code>), and store a pointer to that object in a variable that points to the base class, how can I access the members of the <code>Derived</code> class?</p>
  
  <p>Here's an example:</p>
  
  <pre><code>class Base
  {
      public:
      int base_int;
  };
  
  class Derived : public Base
  {
      public:
      int derived_int;
  };
  
  Base* basepointer = new Derived();
  basepointer-&gt; //Access derived_int here, is it possible? If so, then how?
  </code></pre>