Chapter 6. Acquiring Behavior Through Inheritance
Well-designed applications are constructed of reusable code. Small, trustworthy self-contained objects with minimal context, clear interfaces, and injected dependencies are inherently reusable. This book has, up to now, concentrated on creating objects with exactly these qualities.
Most object-oriented languages, however, have another code sharing technique, one built into the very syntax of the language: inheritance. This chapter offers a detailed example of how to write code that properly uses inheritance. Its goal is to teach you to build a technically sound inheritance hierarchy; its purpose is to prepare you to decide if you should.
Once you understand how to use classical inheritance, the ...