The bank application also manages another sort of account called a checking account. While an ordinary account must maintain a positive balance, a
checkingAccount
may be overdrawn up to an agreed limit.
We use IDL's notion of interface inheritance to capture the intuition that a checking account is a special form of account:
// in module BankingDemo
interface checkingAccount : account {
readonly attribute long limit;
};
The declaration
checkingAccount : account
specifies that the interface
checkingAccount
inherits all the operations and attributes declared in the
account
interface. The body of the definition states that a
checkingAccount
also supports the additional
limit
attribute.
The fact that
checkingAccount
inherits some operations from
account
does not imply that the methods implementing those operations need to be inherited too. We will exploit this flexibility to provide a specialized
debit
method for
checkingAccounts
.