Tuesday, April 13, 2010

What are the features Inheritance offer above an object creation?

1 comment:

Jasmine said...

One of the key benefits of inheritance is to minimise the amount of duplicate code in an application by sharing common code amongst several
Inheritance is a form of Software reusability in which classes are created by absorbing an existing class's data and behaviours, and adding new capabilities.
Software reusability saves times during program development.
It also encourages the reuse of proven and debugged high-quality software, which helps the system to be implemented effectively.
Inheritance can also make application code more flexible to change because classes that inherit from a common superclass can be used interchangeably
Inheritance helps achieve Extensibility which means extending the base class logic as per business logic of the derived class
It also helps to achieve Data hiding ,which means base class can decide to keep some data private so that it cannot be altered by the derived class

when creating a class,instead of writing completely new instances of variables anf methods, the programmer can designate that the new clas should inherit the class variables, properties and methods of another class. The previously defined class is called Base Class, and the new class is referred to as derived class.
Inheritance is an "is-a" relationship ; that is an object of the derived class also can be treated as an object of its base class.