There are two types of Inheritance.
§ Implementation inheritance: Implementation inheritance allows a super class and a subclass to share identical code for the same method.
§ Interface Inheritance: inheritance wherein one or more classes share a set of messages.
Both Car and Boat classes inherit from vehicle supper class. Here Car and Boat are child classes.
Imagine, a smart company builds a vehicle that can be travel on land as well as water called CarBoat (which has properties of Car and Boat)(figure2).
W.G.K.D. Karunarathne (044022)