title: override virtual method with template method
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2354210/can-a-member-function-template-be-virtual">Can a member function template be virtual?</a>  </p>
  </blockquote>
  
  
  
  <p>In a base class, the function <code>my_func</code> is defined as virtual. However, in the derived class I would like to have <code>my_func</code> to be a template method. Is this possible? </p>
  
  <p>It seems it isn't. I get the error <em>"cannot allocate an object of abstract type"</em>, which I believe it is related to the fact that the compiler does not acknowledge the override of the virtual <code>my_func</code> in the base class. Does this reveal a poor design maybe?</p>
  
  <p>Thanks a lot.</p>
  
  <p>UPDATE:
  Thanks for the answers. Some of you are suggesting I should post some of the code, so here it is.
  In the base class:</p>
  
  <pre><code>virtual void Fill(EventInfo* info, EasyChain* tree, vector&lt;Muon*&gt;&amp; muons, vector&lt;Electron*&gt;&amp; electrons, vector&lt;Jet*&gt;&amp; jets, LorentzM&amp; met) = 0;
  </code></pre>
  
  <p>But in the derived class I would like to have:</p>
  
  <pre><code>template&lt;typename _Jet&gt; 
  void Fill(EventInfo* info, EasyChain* tree, vector&lt;Muon*&gt;&amp; muons_in, vector&lt;Electron*&gt;&amp; electrons_in, vector&lt;_Jet&gt;&amp; jets_in, LorentzM&amp; met){
  </code></pre>
  
  <p>From your answers, I understand that a solution to the problem would be to define another function in the derived class:</p>
  
  <pre><code>void Fill(EventInfo* info, EasyChain* tree, vector&lt;Muon*&gt;&amp; muons, vector&lt;Electron*&gt;&amp; electrons, vector&lt;Jet*&gt;&amp; jets, LorentzM&amp; met){
  //
  }
  </code></pre>
  
  <p>but then, this function and the template function are the same for the case of <code>_Jet</code> being <code>Jet*</code>, wouldn't that be a problem as well? </p>
  
  <p>Some have suggested a design problem here, I guess that's true, I'll have to think about how to go around this then.</p>