This chapter discusses a way to enhance the utility of data abstraction by defining families of related types. All members of a family have similar behavior: they all have certain methods, and calls on those methods behave in similar ways. Family members may differ by extending the behavior of the common methods or by providing additional methods.
A type family might correspond to the kind of hierarchy found in the real world; for example,
Cars are both specialized kinds of
Cats are special kinds of
Mammals. Or it might correspond to concepts that only exist within programs; for example, a
BufferedReader is a specialized kind of
A type family is defined by a type hierarchy (see Sidebar ...