Ответ 1
При наследовании вы должны показать, как создать экземпляр родительского шаблона, если тот же шаблонный класс T может быть использован:
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);
}
};
Если нужно что-то еще, просто измените строку:
class InsertItem2 : InsertItem<needed template type here>