10.5 Abstract Classes and Methods
In our Bank Account hierarchy, we could instantiate BankAccount objects, CheckingAccount objects, and SavingsAccount objects. In some situations, however, we will design a class hierarchy where one or more classes at the top of the hierarchy are not intended to be instantiated. Rather, they typically specify patterns for methods that subclasses in the hierarchy must implement. Often, the superclasses do not implement these methods. In these situations, we do not intend that these superclasses will be used to instantiate objects, and we define the superclasses as abstract.
An abstract class is a class that is intended to be extended, rather than instantiated. Usually, an abstract class contains at least one ...
Get Java Illuminated, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.