BankAccount Class Synopsis
BankAccount Class Discussion
classdef BankAccount < handle Handle class because there should be
only one copy of any instance of
BankAccount.“Comparison of Handle
and Value Classes” on page 7-2
properties (Access = ?AccountManager)
AccountStatus = 'open'
endAccountStatus contains the status of
the account determined by the current
balance. Access is limited to the
BankAccount and AccountManager
classes. “Class Members Access” on
page 12-28
properties (SetAccess = private)
AccountNumber
AccountBalance
end
properties (Transient)
AccountListener
endAccountStatus property access by
AccountManager class methods.AccountNumber and AccountBalance
properties have private set access.AccountListener property is
transient so the listener handle is not
saved.See “Specify Property Attributes” on
page 8-7.
events
InsufficientFunds
endClass defines event called
InsufficentFunds. withdraw method
triggers event when account balance
becomes negative.For information on events and listeners,
see “Events”.
methods Block of ordinary methods. See “Methods
and Functions” on page 5-15 for syntax.Developing Classes — Typical Workflow