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 take_for_walk and brush_fur 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 birth_date and required_foods 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!