c++ Partial template specialization of function as pure vitrual

87 views Asked by At

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?

0

There are 0 answers