// ParentClass.h
template <typename T>
Class ParentClass{
ParentClass();
virtual ~ParentClass;
...
};
// ChildClass.h
template <typename T>
Class ChildClass : public ParentClass<T>{
// is a default constructor necessary here or does the
// ParentClass() constructor get called automatically? Destructor?
ChildClass(string str); // this is the constructor I want to make
};
Whenever I try instantiating a new object of ChildClass...
looks like you declaring your template classes as pure header classes -ie definitions with no implementations.
with templates however one makes ones life much simpler by implementing methods of class within header file.
if however you do experiment by seperating your header and implementations in seperate [.h] and [.cpp] files then you will have to include the cpp files in order to use the template.
this however is incorrect and is only mentioned for you to experiment with to get and idea of why the linker fails ... you will notice that by not including the cpp files the compiler was not able to generate the templatized implementations.