title: Call pure virtual function from parent class
body: <p>I'm very new to c++, but I think I understand what is going on.  The parent class is trying to call the pure virtual member function in the parent class.  I thought that by overriding the virtual function in the child class, it would be called instead.  </p>
  
  <p>What am I doing wrong?</p>
  
  <p>Provided for me in parent.h</p>
  
  <pre><code>class Parent
  {
  public:
  virtual void run() = 0;
  protected:
  /** The function to starter routine and it will call run() defined by the
   * appropriate child class.
   * @param arg Arguments for the starter function
   */
  static void * init (void * arg);
  };
  </code></pre>
  
  <p>I'm trying to do this in parent.cpp</p>
  
  <pre><code>void * Parent::init(void * arg)
  {
    run();
  }
  </code></pre>
  
  <p>In my child.h I have this:</p>
  
  <pre><code>class Child : public Parent
  {public:
  //...
  virtual void run();
  //...
  };
  </code></pre>
  
  <p>And in child.cpp I have:</p>
  
  <pre><code>void Child::run()
  {
     sleep(10);
  }
  </code></pre>
  
  <p>The function init in parent.cpp is where this fails to compile.  How do I call a derived function from the parent class?  All my googleing has only turned up notes about not calling virtual functions in the child's constructor.  </p>
  
  <p>Any help at all would be appreciated.</p>