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: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Which software would you use to create a print design? a. illustrator b. audacity c. reaper d. dreamweaver
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 23.06.2019 18:40
Johnson enterprises uses a computer to handle its sales invoices. lately, business has been so good that it takes an extra 3 hours per night, plus every third saturday, to keep up with the volume of sales invoices. management is considering updating its computer with a faster model that would eliminate all of the overtime processing.
Answers: 2
You know the right answer?
Use Inheritance and Polymorphism concepts to create a class named Animal with three derived classes....
Questions
question
Chemistry, 19.03.2021 23:50
question
Chemistry, 19.03.2021 23:50
question
Mathematics, 19.03.2021 23:50
question
English, 19.03.2021 23:50
Questions on the website: 13722361