8. Subclasses and submethods

In the previous chapters, we have seen an example of a how to represent the concept of a bank account by means of a class. Most (all) banks have different kinds of accounts like saving accounts, credit accounts, retirement accounts, and business accounts. Such accounts have different kinds of properties but also a number of properties in common. A credit account may have a property maximum credit whereas all accounts have a property balance.

In this section, we will show how to represent different kind of bank accounts by means of classes organised in a hierarchy. For this purpose, we introduce in section a language mechanism called subclass. In section , we will introduce a similar mechanism for methods called submethod.