Question: Suppose you wish to use inheritance to simplify your code when creating classes and objects to represent companion animals ( pets ) . How should
Suppose you wish to use inheritance to simplify your code when creating classes and objects to represent companion animals pets How should you do this?
a
Create a Pet class with methods such as takeforwalk and brushfur and allow classes such as Gerbil, Parrot, and Turtle to inherit from it
b
Create a Pet class to use for every type of companion animal and instantiate all of your objects from it
c
Create a Pet class with properties such as birthdate and requiredfoods and allow classes such as Dog, Cat, and Fish to inherit from it
d
Create a series of classes, one for each kind of pet, such as Goldfish, Bulldog, and Hamster.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
