October 1997
Intermediate to advanced
800 pages
20h 48m
English
To understand why inheritance is appealing, let's design a small application without inheritance and compare it to one that has inheritance. This approach shows you why inheritance is beneficial from a design perspective and why object-oriented languages like C++ are superior to procedure-oriented languages for implementations.
Suppose a shipping company handles boxes and letters for customer deliveries. The number of pages determines a letter's shipping cost, and the weight determines a box's shipping cost. Boxes and letters have a source and destination, which also affect shipping costs.
The following procedure-oriented approach uses a single Package structure to handle boxes and letters. ...