I'd like to inherit from the template class and change the behavior when the operators "()" are called - I want to call another function. This code
template<typename T>
class InsertItem
{
protected:
int counter;
T destination;
public:
virtual void operator()(std::string item) {
destination->Insert(item.c_str(), counter++);
}
public:
InsertItem(T argDestination) {
counter= 0;
destination = argDestination;
}
};
template<typename T>
class InsertItem2 : InsertItem
{
public:
virtual void operator()(std::string item) {
destination ->Insert2(item.c_str(), counter++, 0);
}
};
gives me this error:
Error 1 error C2955: 'InsertItem' : use of class template requires template argument list...
I'd like to ask you how to do this properly, or if there is another way to do this. Thanks.