View RSS Feed


Inheritence in Java

  1. Inheritance

    by , 01-08-2012 at 12:11 PM
    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
    Tags: inheritance Add / Edit Tags
  2. Inheritance vs. Composition

    by , 01-08-2012 at 11:55 AM
    The concept of inheritance is based on is a relationship. Composition is based on has a relationship. Both of these two concepts allow placing sub objects into your class. Below image explains this key relationship.

    Name:  48.JPG
Views: 1340
Size:  25.3 KB

    Inheritance Vs Composition

    Inheritance is based on one direction concept. You can not apply it in reverse. Extends keyword is used to specify inheritance.

    Composition is used in cases in which ...