Once before, I was certain that you couldn\'t do this, but the other day I was playing around with some code and it seemed to compile and work. I just want to verify that I
A class template can indeed contain virtual or pure virtual functions. This was employed by Andrei Alexandresu in "Modern C++ Design" to implement the visitor pattern using templates and type lists. You can see the code here in his Loki library if you're interested.
With most standard C++ implementations, this is fine, because when the template is instantiated the virtual function ends up being one single function. Consequently, the number of slots needed in the vtable can be known within the translation unit, so a vtable can be generated.
As you mentioned, you cannot have a virtual template member function because the number of vtable slots wouldn't be known within the translation unit.
Hope this helps!