Hello I'm doing a project for school that must use a dynamically allocated array of objects. I'm wondering where I went wrong on this one.
Mammal* Pets = new Mammal[arraysize];
Pets[count] = new Dog(tempweight, tempname)
There is an error that says no operator matches these operands for the second line of code.
Here is my constructor if that helps, and the Dog constructor.
Mammal::Mammal(void)
{
weight = 0;
name = "";
cout << "Invoking Mammal Default Constructor\n";
}
Mammal::Mammal(int tempweight, string tempname)
{
weight = tempweight;
name = tempname;
cout << "Invoking Mammal Constructor\n";
}
Dog::Dog(int tempweight, string tempname)
{
Setweight(tempweight);
Setname(tempname);
cout << "Invoking Dog Constructor\n";
}
Thank you,