Computers and Technology, 09.04.2020 02:06 hhaacahh3588
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;
Answers: 1
Computers and Technology, 23.06.2019 04:31
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
Computers and Technology, 23.06.2019 11:30
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
Computers and Technology, 23.06.2019 19:30
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
Computers and Technology, 23.06.2019 20:30
What are some settings you can control when formatting columns?
Answers: 1
Use Inheritance and Polymorphism concepts to create a class named Animal with three derived classes....
Mathematics, 29.12.2019 21:31
Mathematics, 29.12.2019 21:31
Social Studies, 29.12.2019 21:31
Mathematics, 29.12.2019 21:31
Mathematics, 29.12.2019 21:31
Mathematics, 29.12.2019 21:31
Mathematics, 29.12.2019 21:31
Geography, 29.12.2019 21:31
Mathematics, 29.12.2019 21:31
Mathematics, 29.12.2019 21:31