When designing the account class, we must take into account that this class represents many different types of account. The first order of business is to list all operations you need on any of these accounts. We will then make virtual functions for each of these operations. If we haven't listed all functions two bad things happen
Note that some operations will only be needed on certain types of accounts. This is not a problem, because we will implement all of the functions not directly related to "Account" as dummies. If you made them purely virtual you would have to implement dummies whenever an account class didn't use the function.
For each of the operating functions we should implement a enabler function. These virtual functions allow each account to decide which of its operations can be used. If for example a type of CD does not allow withdrawal, its enabler would return 0. Other CD accounts may allow withdrawal, but only with a penalty. Their enablers would return 1 and their withdrawal function would exact the penalty. Since these enablers are declared in Account, they can be used by the interface to determine which menu item and buttons are active for a given type of account.
As with any windowing application (in any window system), the account class must provide functions that return strings that describe all aspects of the class that might appear in a window. In addition we have to create the functions that give us access to items that are in effect menu items for the main program.
For a complete copy of the header click here.
Back to Week 9.