The concept of inheritance is used in the context of object oriented modeling. Its key objective is to reduce the redundancy in object models by arranging classes with similar attributes and operations in a hierarchy.
Inheritance is a type of relationship among classes, wherein one class shares the structure or behaviour defined in one (single inheritance) or more (multiple inheritance) other classes. Inheritance defines a "kind of" hierarchy among classes in which a sub class inherits from one or more super-classes; a sub-class typically augments or redefines the existing structure and behaviour of its super-classes. 
The example models a fragment of a complaint resolution system. It models the fact that a complaint can either be about the company's product or a product purchased by the company from a supplier. The former complaint would originate from a customer, the latter would originate from within the company itself. In both cases the complainant details, date and description of complaint are recorded. These attributes therefore remain with the super-class "complaint" which models the general case. In the special case of the company product however invoice, credit note and product information needs to be recorded. These attributes are therefore modeled as being unique to the "company product" sub-class. In the case of the supplier product, supplier information, order number, supplier invoice and supplier product information must be recorded. These attributes are therefore unique to the "supplier product" sub-class. In both cases the attributes of the super-class "complaint" plus the attributes of the individual sub-classes completely define the attributes of that sub-class.
In both cases the complaint needs to be recorded and resolved. These operations therefore remain with the super-class "complaint". In the case of a sub-class "company product" a credit note needs to be recorded. This operation therefore augments the operations of this sub-class. As with the attributes the operations of the super-class "complaint" plus the operations of the individual sub-classes completely define the operations of that sub-class.
The sub-classes are said to inherit the attributes and operations of their super-class.
|Multiple inheritance permits a class to
have more than one super-class and to inherit features
from all parents.
In the example an amphibious vehicle has the characteristics of both a land vehicle and a water vehicle. It therefore exhibits multiple inheritance from both these classes.
Software Engineering Web
Copyright ã 1997 Chambers & Associates Pty Ltd
Module: 104 v1.0 c_inhert.htm
Updated: July 02, 2006