mardi 1 octobre 2019

Is there a way to invoke the implementation of the generic class template from its specialization?

I have a template class

template<typename T>
class D : public B {...}

where B is a pure virtual interface implemented in class D. However, for one type T0, the implementation has additional data and an additional member function dealing with this data. Therefore, I have to specialize class D for this case:

template<>
class D<T0> : public B {...}

At the same time, the implementation of all other methods in this specialization is exectly the same as in the generic case, and I do not want to copy-paste it. The question is, how to call the generic implementation in the class D from the class D<T0>, if this at all possible.

Aucun commentaire:

Enregistrer un commentaire