Inheritance


| Site Map | Home Page | OOP Concepts | OOP Design | Glossary | Evaluation/Comments |

As objects do not exist by themselves but are instances of a CLASS, a class can inherit the features of another class and add its own modifications. (This could mean restrictions or additions to its functionality). Inheritance aids in the reuse of code.

Classes can have 'Children' that is, one class can be created out of another class. The original or parent class is known as the SuperClass (or base class). The child class is known as the SubClass (or derived class).

A SubClass inherits all the attributes and behaviors of the SuperClass, and may have additional attributes and behaviors.

Another example of inheritance BELOW is called a Single Inheritance.

The attributes and operations in the diagram below are for vehicle class, which the SubClass inherits. Extra operation is the land Vehicle works only on Land and the water vehicle works only in water.

Next example below is of Multiple Inheritance


Click here to try Inheritance Test

<< Encapsulation Polymorphism >>




Links to the rest of the site:
| Site Map | Home Page | OOP Concepts | OOP Design | Glossary | Evaluation/Comments |

Author: Deniz Zubair Choudhury
Last Update: May 1999