Inheritance is a powerful programming technique, and brings with it many benefits. Among these are the following:
Inheritance is a primary tool for software reuse, since parent abstractions are reused in the development of new child classes.
If both parent and child are developed new for a given application, we can still derive the benefit of code sharing since a single parent may be applicable to many child abstractions.
A parent class may be used in many different child classes, and across many different types of applications. Constant use tends to drive out bugs, and hence a frequently used parent class will likely have higher reliability than a seldom used component.
If a number of classes inherit from the same parent, they will have a consistency of interface and use. The GUI components in the Java windowing system are a good example of this.
If a good part of the functionality of a new application has already been captured in parent classes, then the new application can be developed much more quickly than it could be if it were necessary to write the entire system from scratch.
Inheritance is the enabling concept that permits polymorphism, a topic we will address in detail in later chapters.
Finally, inheritance permits details of the parents operation to be hidden from child classes, and is thus yet another mechanism for information hiding.