O'Reilly logo

Program Development in Java: Abstraction, Specification, and Object-Oriented Design by John Guttag, Barbara Liskov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7 Type Hierarchy

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, Busses and Cars are both specialized kinds of Vehicles, or Dogs and 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 Reader.

A type family is defined by a type hierarchy (see Sidebar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required