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?
- How to dynamically allocate arrays in C++
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- Why is “using namespace std;” considered bad practice?
- What is a lambda expression in C++11?
- How to convert string to char array in C++?
- ld: symbol(s) not found for architecture x86_64 error
- C++ string to double conversion
- How do I print out the contents of a vector?
- How do I reverse a C++ vector?
- Is there a C++ decompiler?
- What is a dangling pointer?
- undefined reference to WinMain@16 (codeblocks)
- Why use ‘glad’ library for opengl initialization? [duplicate]
- What does `*&` in a function declaration mean?
- (->) arrow operator and (.) dot operator , class pointer
- Difference between const reference and normal parameter
- Why am I getting this redefinition of class error?
- error: redefinition of class
- How to convert a std::string to const char* or char*
- What is the difference between a static and const variable?
- What is move semantics?
- Static array vs. dynamic array in C++
- C++ terminate called after throwing an instance of ‘std::out_of_range’ Simple Averaging code
- Error “C++ requires a type specifier for all declarations whilst defining methods”
- How to create a dynamically-allocated array of const objects, but have values assigned to them?
- Why doesn’t std::vector::push_front() exist?
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Invalid use of non-static member function c++
- C++ #include guards
- Is std::stoi actually safe to use?
- C++ forbids variable-size array
- Fill array with random numbers within a specified range (C++)
- Remove an array element and shift the remaining ones
- 2D array vs array of arrays
- C++ error: definition of implicitly-declared
- Already defined in .obj – no double inclusions
- expected unqualified-id before string constant
- C++: Access violation writing location
- error: strcpy was not declared in this scope
- how to print a string to console in c++
- What are the different versions of exec used for in C and C++?
- C++ – include unistd.h: why not cunistd?
- Dynamically allocated string array, then change it’s value?
- Use the auto keyword in C++ STL
- how to convert from int to char*?
- When is it safe to call this-> in constructor and destructor
- The difference between cin.ignore and cin.sync
- casting int to char using C++ style casting
- How to print (using cout) a number in binary form?
- MSVCP120d.dll missing
- Modulo operator with negative values [duplicate]
- Finding the type of an object in C++
- C++ Simple Dice roll – how to return multiple different random numbers [duplicate]
- How can I get a file’s size in C++?
- Whats the difference between UInt8 and uint8_t
- error: no member function declared in class
- Why does my program give “NULL used in arithmetic”
- no matching function to call for “getline”