Create an abstract base class "Animal" which has a name as data member.
A suitable constructor is to fill the data member.
A purely virtual function "makeSound" outputs the sound of the animal.
The subclasses "cow" and "dog" are to implement this function and output the sounds "Moo" and "Woof".
Create an instance of the classes "Cow" and "Dog" in your main program.
Give the animals names. Output the names and their sounds.
\ No newline at end of file
Create an abstract base class "Animal" which has a name as data member.
A suitable constructor is to fill the data member.
A purely virtual function "makeSound" outputs the sound of the animal.
The subclasses "cow" and "dog" are to implement this function and output the sounds "Moo" and "Woof".
Create an instance of the classes "Cow" and "Dog" in your main program.
Give the animals names. Output the names and their sounds.