Our focus is on the use of restrictive access to accessors and mutators.
Contributors
AbstractBankAccount - which has the usual interface for fund management.
BankAccount - Concrete implementation of above
AccountProxy - Non-restrictive proxy which derives from subject
RestrictedAccountProxy - subclass of AccountProxy which restricts access to deposits and displays only.
Notes:
By deriving the base AccountProxy from AbstractBankAccount, the proxy can be used as the latter (as in our example). But this is not required, if you want your application to expose the proxy types then you wouldn't need to derive from the domain types. This may prove more flexible in a complex class model.