Question: Suppose a class Car and its subclass Honda both have a method called speed as part of the class definition. rentalH refers to an object

Suppose a class Car and its subclass Honda both have a method called speed as part of the class definition. rentalH refers to an object of the type Honda and the following statements are found in the code:
rentalH.cost();
super.speed();
What does the second statement in the description above do?
A. The speed method in Honda will be called.
B. The speed method in Car will be called.
C. Nothing will be called since the code will not compile as a result of multiple definitions of speed.
D. Overloading will be used to determine which method of speed to use.

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!