Assignment Help
Assignment Help| Demonstrate inheritance by creating the following:
Demonstrate inheritance by creating the following:
- Create the class Animal with the following properties and behaviours
- Properties (variables)
- Name
- Number of legs
- Behaviours (functions)
- Speak (default this to the animal saying their name. Ex: “Hi, I am a Penguin!”)
- Mutators and accessors for the properties
- Properties (variables)
Create two more classes called Cat and Dog (or 2 animals of your choosing) and inherit from the class Animal. Override the Speak function to say something unique for each animal type.
Demonstrate all behaviour by creating instances of Animal, Cat and Dog. Have each object “speak”.