title: C++: How to call a parent class function from outside
body: <p>I have:</p>
  
  <pre><code>class A{
      public:
          virtual void foo();
  };
  
  class B : public A{
      public:
          void foo();
  };
  
  B *ptr = new B();
  </code></pre>
  
  <p>I want to call A's <code>foo()</code> DIRECTLY using the 'ptr' pointer.</p>
  
  <p>When I try</p>
  
  <pre><code>(A*)ptr-&gt;foo();
  </code></pre>
  
  <p>it still calls B's version of <code>foo()</code>. How do I call A's version instead?</p>
  
  <p>Is this possible? What are the alternatives? Thank you.</p>