creation: 2/14/99; revisions: 2/25/99, 7/17/99, 01/24/00, 07/28/2002, 06/05/03, 07/19/10, 07/21/14, 09/20/17

go to home page   go to next page

CHAPTER 81 — Abstract Classes and Polymorphism

Classes in a hierarchy are related by the is-a relationship. For example, a Nissan is-a Automobile, and a Sentra is-a Nissan. Java has features that allow programs to establish and work with hierarchies. Much of the power of object oriented programming comes from this.

An abstract class is a class that cannot be instantiated but that can be the parent of other classes. This is useful when you have a broad concept (like Automobile) but actual objects must be specific types (like Sentra).

This chapter also discusses polymorphism. Polymorphism is when a variable of a base type (like Automobile) can refer to various derived types (like Nissan or Sentra) as needed.

Chapter Topics:


How many Valentine cards did you get this year?

go to home page   go to next page