Vahag Chakhoyan
Vahag Chakhoyan

Reputation: 779

c++ Partial template specialization of function as pure vitrual

Suppose I have a template in C++

template<typename T>
class my_class
{
    virtual void my_func(int i);
};

Now I want to partially specialize my_func to be a pure virtual function;

template<>
my_class<ExcistingClass>::my_func(int i) = 0;

but compiler gives an error

error C2988: unrecognizable template declaration/definition
error C2059: syntax error : '='

why does the compiler not recognize the logic I wrote, and how can I implement such logic correctly?

Upvotes: 0

Views: 89

Answers (0)

Related Questions