title: call sub class method from base class specific function
body: <p>I've got a question concerning handling of virtual function in C++ programming. I have something like this:</p>
  
  <pre><code>template&lt;class T&gt;
  class baseClass
  {
      virtual void doSomething(T&amp; t) {
          // some baseClass specific code
      }
  
      void doSomethingElse(T&amp; t) {
          // some baseClass specific code
  
          this-&gt;doSomething(t);
      }
  }
  
  template&lt;class T&gt;
  class subClass
  {
      virtual void doSomething(T&amp;) {
          // some subclass related code
      }
  }
  </code></pre>
  
  <p>Now, if I construct an object of type subClass....</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
      subClass&lt;anyType&gt; * subClassObject = new subClass&lt;anyType&gt;();
      subClassObject-&gt;doSomethingElse(anyTypeObject);
  }
  </code></pre>
  
  <p>....  and call the <code>doSomethingElse</code> method of the base class, this method will call the <code>doSomething</code> method of the base class and not of the sub class.</p>
  
  <p>What I want to have, is calling the <code>doSomething</code> method of the subclass (not of the <code>baseClass</code>). </p>
  
  <p>Can anybody tell me how to accomplish that?</p>