virtual methods and template classes
- by soxs060389
Hi
I got over a problem, I think a very specific one.
I've got 2 classes, a B aseclass and a D erived class (from B aseclass).
B is a template class ( or class template) and has a pure virtual method virutal void work(const T &dummy) = 0;
The D erived class is supposed to reimplement this, but as D is Derived from B rather than D being another template class, the compiler spits at me that virtual functions and templates don't work at once.
Any ideas how to acomplish what I want?
I am thankfull for any thoughts and Ideas, especially if you allready worked out that problem
this class is fixed aka AS IS, I can not edit this without breaking existing code base
template <typename T>
class B {
public:
...
virtual void work(const T &dummy) = 0;
..
};
take int* as an example
class D : public B<int*>{
...
virtual void work(const int* &dummy){ /* put work code here */ }
..
};
Edit: The compiler tells me, that void B<T>::work(const T&) [with T = int*] is pure virtual within D