Multiple Choice Question

Quiz Guidelines

 

QID: 
373
Question: 

You are modeling a class hierarchy for living things. You have a class LivingThing which has an abstract method reproduce().
Now, you want to have 2 subclasses of LivingThing - Plant and Animal. Both do reproduce but the mechanisms are different. What would you do?

Select 1 option

A. Overload the reproduce method in Plant and Animal classes
B. Overload the reproduce method in LivingThing class.
C. Override the reproduce method in Plant and Animal classes
D. Either overload or override reproduce in Plant and Animal classes, it depends on the preference of the designer.

Q&A Set: