Inheritance and Polymorphism

Of OOP's three defining traits, encapsulation, inheritance and polymorphism, we have so far concentrated on encapsulation. In this module we will turn our attention to inheritance and polymorphism. Recall that inheritance enables one class to inherit the characteristics of another one (where by characteristics we mean attributes and methods). Polymorphism refers to the ability of the same operation to trigger different behaviours in different contexts, or in syntactic terms for the same operator, e.g. +, to do different things to different object types.