Dziedziczenie szablonów klas C ++
Chciałbym dziedziczyć z klasy szablonu i zmieniać zachowanie, gdy wywoływane są operatory „()” - chcę wywołać inną funkcję. Ten kod
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);
}
};
daje mi ten błąd:
Error 1 error C2955: 'InsertItem' : use of class template requires template argument list...
Chciałbym zapytać, jak to zrobić poprawnie lub czy istnieje inny sposób, aby to zrobić. Dzięki.