+ 3
How do i inherit a template class in c++
I'm practicing, and I am trying inherit a class template but the code get error, how to solve it? https://code.sololearn.com/cKhbglUg872w/?ref=app
3 Answers
+ 4
Op has two type parameters. Upon inheriting you pass none. You have to specify what Op's T and S are supposed to be when declaring class Calc.
Class Calc has one type parameter which you may pass on to Op. So, something like this is probably what you are looking for:
template <class T>
class Calc : public Op<T, int>
{
...
};
+ 6
Thank you
+ 3
You're welcome.