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>
Related Posts:
- Here is some error with my .h file which show [Error] unterminated #ifndef when I include my class template in it
- Error: “expression must have integral or unscoped enum type” [duplicate]
- Officially, what is typename for?
- Logical XOR operator in C++?
- Inheriting constructors
- Inheriting constructors
- Argument list for class template is missing
- What does “missing template argument” mean?
- What does “missing template argument” mean?
- What is ‘\0’ in C++?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- error: ‘ostream’ does not name a type
- Multiple OR or AND conditions in IF statement
- cannot declare variable ‘’ to be of abstract type ‘’
- “Implicit instantiation of undefined template” when forward declaring template class
- How to call a parent class function from derived class function?
- “used without template parameters”
- QltAW.png
- C++ template constructor
- What is object slicing?
- Why is inherited member not allowed?
- error C2106: ‘=’ : left operand must be l-value
- c++ –
- use of class template requires template argument list
- C++ Templates – LinkedList
- C++ template – error: expected initializer before ‘<' token
- template argument deduction/substitution failed, when using std::function and std::bind
- got “cannot appear in a constant-expression” when using template
- In C++ what does template<> mean?
- non-member function cannot have cv-qualifier
- How can I add reflection to a C++ application?
- Unrecognizable template declaration/definition
- error C2244 unable to match function definition to an existing declaration
- Struct inheritance in C++
- What is the difference between the dot (.) operator and -> in C++?
- C++ calling base class constructors
- error C2995: function template has already been defined
- invalid use of template name without an argument list
- Struct with template variables in C++
- The tilde operator in C
- Template constructor in a class template – how to explicitly specify template argument for the 2nd parameter?
- Is “delete this” allowed in C++?
- What is a segmentation fault?
- How many spaces for tab character(\t)?
- How to create a dynamic array of integers
- How to create a dynamic array of integers
- Linker Error C++ “undefined reference ” [duplicate]
- How do I build a graphical user interface in C++? [closed]
- C++ convert from 1 char to string?
- How do I build a graphical user interface in C++? [closed]
- convert a char* to std::string
- system(“pause”); – Why is it wrong?
- Pause Console in C++ program
- system(“pause”); – Why is it wrong?
- Pause Console in C++ program
- How to implement 2D vector array?
- Why the switch statement cannot be applied on strings?
- What is the difference between g++ and gcc?
- How to use setprecision in C++
- How to dynamically allocate arrays in C++
- What does (~0L) mean?
- How to dynamically allocate arrays in C++
- What is the best way to use a HashMap in C++?
- What is the best way to use a HashMap in C++?
- What are the differences between a pointer variable and a reference variable in C++?
- What is an undefined reference/unresolved external symbol error and how do I fix it?
- Sleep for milliseconds
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- Easiest way to convert int to string in C++
- What is the difference between float and double?
- Why is “using namespace std;” considered bad practice?
- What is the easiest way to initialize a std::vector with hardcoded elements?
- outputting ascii table in C++
- What is a lambda expression in C++11?
- Vector of Vectors to create matrix
- How to throw a C++ exception
- std::string to char*
- How to generate a random number in C++?
- pinpointing “conditional jump or move depends on uninitialized value(s)” valgrind message
- What is an undefined reference/unresolved external symbol error and how do I fix it?
- How do I find the length of an array?
- Sleep for milliseconds
- How to convert string to char array in C++?
- C++ — expected primary-expression before ‘ ‘
- Using getline() with file input in C++
- What is the effect of extern “C” in C++?
- C++ Cout & Cin & System “Ambiguous” [closed]
- ld: symbol(s) not found for architecture x86_64 error
- C++ string to double conversion
- Why are #ifndef and #define used in C++ header files?
- g++ ld: symbol(s) not found for architecture x86_64
- What exactly is the difference between “pass by reference” in C and in C++?
- How to throw a C++ exception
- Conversion from string to char – c++
- How to find out if an item is present in a std::vector?
- What is meant by Resource Acquisition is Initialization (RAII)?
- When to use extern “C” in simple words? [duplicate]
- What is `CString`?
- Floating point exception( core dump