EIFFEL

INHERITANCE

INHERITANCE



Inheritance is a fundamental generalization mechanism. It allows the definition of a new class by changing certain characteristics of existing classes.

Eiffel has a special syntax for depicting inheritance and it involves the keyword "inherit". The inherit clause in a class statement lists all the "parents" (those classes from which the new class evolved). The new class itself is referred to as the heir. Naturally, this new class can have "descendents". If the new class possesses more than one "parent", it is said to have "multiple inheritance".

By default, inherited features keep their export status publicly available, private or only available to a select few! This however my be changed once the heir is established.

Eiffel has a windowing system based on a class WINDOW. These windows have graphical features such as height, width, position and routines to change teir position and scale. Windows can also be inherited as the system allows them to be nested. All hierarchical features in Eiffel are inherited from a class describing trees; TREE. All the graphical features are from a class called RECTANGLE.

An advantage of inheritance is that it takes little effort to produce results. It can be used for analysis, design, implementation and evolution, and it affect the total software development process.

An advantage that inheritance may possess is aliasing. There may be name conflicts between feature inherited. The contributions of independent developers may further heighten this. However this problem can be eliminated by renaming.