When I inherit from a templated class and provide the argument during the inheritence, how do I have to handle functions from the parent class, which use the template argument?
For example with this class as the parent:
template<typename T>
class Parent {
public:
virtual T someFunction(const T& data);
};
and I try to inherit like this:
class CharVersion : Parent<char> {
public:
T someFunction(const T& t) override {
return 'c'
}
};
How can I get the function in the child to act like:
char someFunction(const char& t) override {
return 'c'
}
The compiler obviously doesn't know T
in the subclass, so how can I express this?