14-4. Inheritance Class Polymorphism

Define a Vehicle parent class and have Car, Ship, and Airplane as its child classes. Each child class inherits methods from the Vehicle class and can override methods as needed.

In this example, Car, Ship, and Airplane inherit the move() method from the Vehicle class. However, each child class provides its own implementation of the move() method, which allows for polymorphic behavior when calling move() on objects of these classes.

Output:

Ford
F-150
50000
Car moves on roads.
Boston Whaler
Vintage
250000
Ship moves on water.
Boeing
777
1000000
Airplane flies in the sky.