by, 01-08-2012 at 12:11 PM (1045 Views)
Process of including methods and variables of base class into its child class is known as Inheritance. The core benefit of Inheritance is code reusability. In case of shared code, move it to base class to refractor and improve the code. It is also a process in which characteristics of one object are transferred into another object.
Two main forms of inheritance are as following:
- Implementation inheritance: Functionality of the parent class is reused in the child or derived class. Java supports on inheritance from one class. In this case the child class is tightly coupled with parent.
- Interface inheritance: It supports relationships between unrelated classes. It also reduces coupling between classes and increases code reusability and modularity.