June 2006
Intermediate to advanced
1344 pages
42h 52m
English
When we think of a class type, we assume that programs will create objects of that type. In some cases, however, it is useful to declare classes for which you never intend to instantiate objects. Such classes are called abstract classes. Because they are used only as base classes in inheritance hierarchies, we refer to them as abstract base classes. These classes cannot be used to instantiate objects, because, as we will soon see, abstract classes are incomplete. We demonstrate abstract classes in Section 11.5.
The purpose of an abstract class is primarily to provide an appropriate base class from which other classes can inherit and thus share a common design. In the Shape hierarchy of Fig. 10.3, for example, ...
Read now
Unlock full access