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.
Multiple Inheritance
Both Car and Boat classes inherit from vehicle supper class. Here Car and Boat are child classes.
Diamond Inheritance
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).
Figure2W.G.K.D. Karunarathne (044022)
Level4
0 comments:
Post a Comment