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
templa
When inheriting you must show how to instantiate the parent template, if same template class T can be used do this:
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<T>
{
public:
virtual void operator()(std::string item) {
destination ->Insert2(item.c_str(), counter++, 0);
}
};
If something else is needed just change the line:
class InsertItem2 : InsertItem<needed template type here>