Reputation:
Lets say I have an template class and i would like to derive it from an abstract class
I wrote the abstract class declaration as follows:
template<typename T, class Derived>
class AbstractClass{
};
How do I derive my template class correctly? At the moment it looks like:
template <typename T>
class TemplateClass{};
Upvotes: 1
Views: 149
Reputation: 62563
I see you are playing with CRTP? The proper way is following:
template <typename T>
class TemplateClass : public AbstractClass<T, TemplateClass<T> > {};
Upvotes: 3