Inheritance was defined in Chapter 1 as a system in which children inherit attributes and behavior from a parent class. However, there is more to inheritance, and in this chapter we will explore inheritance in greater detail.
Chapter 1 states that you can determine an inheritance relationship by following a simple rule: If Class B is a Class A, then this is a good candidate for inheritance.
One of the primary rules of OO design is that public inheritance is represented by an is-a relationship. Let's revisit the mammal example used in Chapter 1. To present a very simple example, let's concentrate on a Dog class. A dog has several behaviors that make it distinctly a dog, as opposed to a cat. For this example, let's specify two: ...