Skip to content
Snippets Groups Projects
Commit 6f2f8a46 authored by Rudi Buss's avatar Rudi Buss
Browse files

Update Exercise 3 - Animal.txt

parent 23f4545c
Branches main
No related tags found
No related merge requests found
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.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment