I am writing a template class, and then need to write test cases to test my code and verify all of the methods work properly. In my testing file, I attempt to create an instance of Collection, but get the following error: "no instance of constructor "Collection" matches the argument listC/C++(289)". I have a no-arg constructor defined, so I am not sure why it is not working.
Here is the portion of my class where I define the constructor:
template <typename Object>
class Collection
{
// TODO(student): the rest of the template
private:
Object *objectsArr;
int maxArrSize = 10;
int sizeOfCollection = 0;
public:
Collection()
{
objectsArr = new Object[maxArrSize];
}
and in the test file, I try to instantiate the Collection with:
Collection<int> testCollection = new Collection();
This is where i get the error message: "no instance of constructor "Collection" matches the argument listC/C++(289)".
Can someone help me understand why I am receiving this error message?