title: Calling derived class method from base class pointer
body: <pre><code>//Parent.h
  class Parent
  {
  public:
      virtual void foo() = 0;
  };
  
  //Child.h
  class Child : public Parent
  {
  public:
      virtual void foo(){cout &lt;&lt; "inside function foo()" &lt;&lt; endl;}
      virtual void bar(){cout &lt;&lt; "inside function bar()" &lt;&lt; endl;};    
  };
  
  int main( int argc, char** argv ){
      Parent* pa = new Child;
      pa-&gt;foo();
      pa-&gt;bar(); //Error, class Parent have no member bar
      return 0;
  }
  </code></pre>
  
  <p>How do i avoid this error other than add those function to the <code>Parent</code> class</p>