Ask Question
20 March, 11:39

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. 20 March, 12: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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers