Ask Question
15 July, 08:22

Vehicle aVehicle = new Auto (); aVehicle. moveForward (200); Assume that the Auto class inherits from the Vehicle class, and both classes have an implementation of the moveForward method with the same set of parameters and the same return type. What determines which class's moveForward method is to be executed? A. the actual object type. B. the variable's type. C. the hierarchy of the classes. D. it is not possible to determine which method is executed.

+5
Answers (1)
  1. 15 July, 11:40
    0
    Hi!

    The correct answer is A) the actual object type.

    Explanation:

    The Auto class inherits from Vehicle class. This means that Auto inherit attributes and methods from Vehicle, but moveForward method has an implementation in Auto class with the same set of parameters and same return type (or sub-type) as a method in Vehicle, then the method in the Auto is said to override the method in the Vehicle. So, the actual object type will be executed.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Vehicle aVehicle = new Auto (); aVehicle. moveForward (200); Assume that the Auto class inherits from the Vehicle class, and both classes ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers