On removing the constructor line the error dissapears.
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;
}
class Animal {
private:
std::string name;
double height;
double weight;
static int numOfAnimals;
static bool canTalk;
public:
std::string GetName() {
return name;
}
double GetHeight() {
return height;
}
double GetWeight() {
return weight;
}
void SetName(std::string name) {
this->name = name;
}
void SetHeight(double height) {
this->height = height; //height that is passed in through parameter becomes the height
}
void SetWeight(double weight) {
this->weight = weight;
}
void SetAll(std::string, double, double);
Animal(std::string, double, double); //constructor
Animal(); //for when no parameters are passed
~Animal(); //destructor
static int GetNumOfAnimals() {
return numOfAnimals;
}
void ToString();
};
code and constructor of animal class as requested by @inisheer