virtual void talk() = 0;
specifies a function with return type void
. This means it does not return anything. The same happens when you define Animal::move
as virtual void move() = 0;
.
out << animal.getAnimalType() << animal.talk() << ", " << animal.move();
tries to print the result of animal.talk()
and the result of animal.move()
- neither of which exists (remember, neither talk()
nor move()
return any value!)