Inheritance is an OO concept that is designed to support code reuse by allowing classes within a program to extend or change the functionality of existing classes.
The Parent or Super Class is inherited from by the Subclass. All the public behaviour of the super class can be accessed through an instance of the subclass. In the example hierarchy class C also has the behaviour of duck and dive inherited from class A.
The process of Specialisation allows the subclass to add extra functionality by adding new methods. it also allows the subclass to change the functionality of inherited behaviour by overriding existing inherited methods with new ones. This is one form of polymorphism. In the example class B overrides the dive behaviour inherited from class A with its own 'dive method.
|Techniques: Abstraction | Aggregation versus Composition | Association versus Dependency | Coupling | Encapsulation | Information hiding | Inheritance | Multiple Inheritance | Overloading | Polymorphism|