How can i create a template prototype that declares the class to inherit from an interface ?
I want all specializations of that class to inherit from the same interface.
Something like:
template <typename T>
class A : public BaseInterface { }
template <>
class A<int> { } //somehow still inherit from the interface "BaseInterface"
You can’t. Templates just aren’t “classes”. They’re “templates for classes” (read templates here not as the C++ term, but the English language term). They’re skeletons on which actual classes are built. So when you say:
you’re not actually declaring a class, you’re providing a rule for some classes that will be built. Also, when you specialize a template
you’re explicitly saying you want it to behave differently for this specialization.