Next:
2.14.4 Transactions
Up:
2.14 Shared Data and
Previous:
2.14.2.2 Example
2.14.3 Automatic Teller Machines and Bank accounts
An ATM or cashmachine allows transfer of funds between accounts.
Accounts are held at various machines belonging to different banks
Accounts offer the following operations
deposit
Place an amount of money in an account
withdraw
Take an amount of money from an account
balance
Get the current value in an account
Operations implemented as read() and write() of values, so withdraw x from A and deposit x in B implemented as
A.write(A.read() - x)
B.write(B.read() + x)
Next:
2.14.4 Transactions
Up:
2.14 Shared Data and
Previous:
2.14.2.2 Example
Ian Wakeman 2005-02-22