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, 24.06.2019 02:10
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
Looking at the electroscope, describe how you can cause the two leaves at the bottom to repel each other and stay that way
Answers: 3
question
Computers and Technology, 24.06.2019 21:40
is on drugs i swear i ask a question and its not showing whats going
Answers: 2
You know the right answer?
Use Inheritance and Polymorphism concepts to create a class named Animal with three derived classes....
Questions
question
Mathematics, 03.02.2021 20:00
question
Mathematics, 03.02.2021 20:00
question
Mathematics, 03.02.2021 20:00
Questions on the website: 13722367