Ask Question
27 February, 07:57

Consider a class hierarchy that includes a class called Vehicles, with subclasses called and Airplane. The Vehicle class has a method called overridden in the class. The getMaxSpeed of the Vehicle class returns the method Car class I overridden to return 150 mph. What is the output of the following snippet of code?

+1
Answers (1)
  1. 27 February, 11:57
    0
    The code is not shared, but let me explain how it works. I believe there is also a class called Car.

    Explanation:

    If the object is created using Car class - Vehicle ob = Car (); the result will be the return value of getMaxSpeed in Car class.

    If the object is created using Airplane class - Vehicle ob = Airplane (); the result will be the return value of getMaxSpeed in Airplane class.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Consider a class hierarchy that includes a class called Vehicles, with subclasses called and Airplane. The Vehicle class has a method ...” 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