title: Creating an interface for an abstract class template in C++
body: <p>I have the code as below. I have a abstract template class Foo and two subclasses (Foo1 and Foo2) which derive from instantiations of the template. I wish to use pointers in my program that can point to either objects of type Foo1 or Foo2, hence I created an interface IFoo.</p>
  
  <p>My problem is I'm not sure how to include functionB in the interface, since it is dependant on the template instantiation. Is it even possible to make functionB accessible via the interface, or am I attempting the impossible?</p>
  
  <p>Thank you very much for your help.</p>
  
  <pre><code>class IFoo {
      public:
          virtual functionA()=0;
  
  };
  
  template&lt;class T&gt;
  class Foo : public IFoo{
      public:
          functionA(){ do something; };
          functionB(T arg){ do something; };
  };
  
  class Foo1 : public Foo&lt;int&gt;{
  ...
  };
  
  class Foo2 : public Foo&lt;double&gt;{
  ...
  };
  </code></pre>