Solved

Suppose a Class Car and Its Subclass Honda Both Have

Question 32

Multiple Choice

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() ;In the scenario described in the accompanying figure, what will the first statement do?


A) The cost method in Honda will be called.
B) The cost 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 cost method to use.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents