title: Template Child Class Overriding a Parent Class's Virtual Function
body: <p>The below code compiles with gcc v4.3.3 and the templated child class seems to be overriding a virtual function in the parent, but doesn't that break the rule that you cannot have a virtual template function?  Or is something else happening that I don't understand?</p>
  
  <pre><code>class BaseClass
  {
  public:
    virtual void Func(int var)
    {
      std::cout&lt;&lt;"Base int "&lt;&lt;var&lt;&lt;std::endl;
    }
  
    virtual void Func(double var)
    {
      std::cout&lt;&lt;"Base double "&lt;&lt;var&lt;&lt;std::endl;
    }
  };
  
  template &lt;class TT&gt;
  class TemplateClass : public BaseClass
  {
  public:
    using BaseClass::Func;
    virtual void Func(TT var)
    {
      std::cout&lt;&lt;"Child TT "&lt;&lt;var&lt;&lt;std::endl;
    }
  };
  
  int main(int argc, char **argv)
  {
    BaseClass a;
    TemplateClass&lt;int&gt; b;
    BaseClass *c = new TemplateClass&lt;int&gt;;
  
    int intVar = 3;
    double doubleVar = 5.5;
  
    a.Func(intVar);
    a.Func(doubleVar);
    b.Func(intVar);
    b.Func(doubleVar);
    c-&gt;Func(intVar);
    c-&gt;Func(doubleVar);
    delete c;
  }
  </code></pre>
  
  <p>This then outputs: </p>
  
  <p>Base int 3<br>
  Base double 5.5<br>
  Child TT 3<br>
  Base double 5.5<br>
  Child TT 3<br>
  Base double 5.5  </p>
  
  <p>as I hoped, but I'm not sure why it works.</p>