On removing the constructor line the error dissapears.
However there might be an easy solution to the question, but i urge you to take the question with a grain of salt as i always let stack overflow be the last resort.
Dog::Dog(std::string name, double height, double weight, std::string sound) : Animal(name, height, weight) {
this -> sound = sound;
}
void Dog::ToString() {
//std::cout << this->name << " is " << this->height << " cm's tall and " << this->weight << " kg's in weight" << std::endl;
//cannot do the line above as it is private, if it were to be protected we could call it. "sharing with childs of class"
std::cout << GetName() << " is " << GetHeight() << " cm's tall and " << GetWeight() << " kg's in weight" << std::endl;
}

Aucun commentaire:
Enregistrer un commentaire