How to make a dynamically allocated array that can hold derived objects in c++ -
Hello, I am doing a project for school that should use a dynamic allocated array of objects. I am wondering where I went wrong on this.
There is an error which says that no operator matches these operands for the second line of code. If my creator helps it, and the dog is the creator. Thanks, To declare you an array Like the indicator,: Mammals * Pets = New mammals [gallop]; Pets [Calculation] = New Dog (Template, Tempamark)
Mammal :: mammals (zero) {weight = 0; Name = ""; Cout & lt; & Lt; "Including Mammalian Default Constructor \ n"; } Mammal :: Mammal (Int tempvate, string template) {weight = tempweight; Name = tempname; Cout & lt; & Lt; "Including Mammalian Constructor \ n"; } Dog :: Dog (int tempvate, string template) {SetVette (Template); Setname (tempname); Cout & lt; & Lt; "Inviting Dog Constructor \ n"; }
mammals ** pets = new mammals * [Erezes];
Comments
Post a Comment