subject

Use Inheritance and Polymorphism concepts to create a class named Animal with three derived classes. Each Animal has different characteristics and act different. Create a class that will show these differences by creating objects of type Animal, Dog, Cat and Bird.

Create a base class named Animal with three derived classes named
Gorilla,
Fish, and
Bird.
Create a derived class named Penguin whose base class is Bird.
Create constructors for each class.
Create destructors for each class.
All classes will have the following private instance fields, including Animal
legs that will initialize to 0
boolean swim that will initialize to false;
All classes will have the following polymorphic methods, including Animal
getLegs( ) – this returns the number of legs the animal has
makeSount( ) – this outputs the type of sound the animal makes
canSwim( ) - this will return true or false
makeSound( ) method will be a virtual function in the Animal class
Create an exception in the getLegs( ) method that makes sure the number of legs are valid
Create a main method to demonstrate the all functions including the following with appropriate output

Animal animal;
animal. makeSound();
Dog dog
dog. makeSound();
cout << dog. getLegs();
Animal badDog = Dog();
badDog. makeSound();
cout << badDog. getLegs();
Animal* goodDog = new Dog();
goodDog->makeSound();
cout << goodDog->getLegs;

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 01:00
Verify each identity[tex] \frac{csc}{cot \: x \: + \: tan \: x} = cos \: x[/tex]
Answers: 1
question
Computers and Technology, 24.06.2019 07:20
Ingrid started speaking about her slide presentation. when she clicked to th"third slide, which had just a picture of an elephant, she forgot what she wassupposed to talk about. what could ingrid do to avoid this situation in thefuture? oa. print handouts for her audience.ob. add presenter's notes to each slide.oc. add a video to each slide.od. save her slide presentation to a flash drive
Answers: 2
question
Computers and Technology, 24.06.2019 23:00
The valves of the heart and veins are similar in that they both
Answers: 1
question
Computers and Technology, 25.06.2019 00:30
Which type of cell references are locked and not automatically updated when it’s copied a)formula b)relative c)absolute d)worksheet
Answers: 1
You know the right answer?
Use Inheritance and Polymorphism concepts to create a class named Animal with three derived classes....
Questions
question
Mathematics, 05.07.2019 03:40
question
Mathematics, 05.07.2019 03:40
Questions on the website: 13722363