Modeling Operations

To identify operations, we examine the verb phrases listed for each class in Fig. 22.16. The “executes financial transactions” phrase associated with class ATM implies that class ATM instructs transactions to execute. Therefore, classes BalanceInquiry, Withdrawal and Deposit each need an operation to provide this service to the ATM. We place this operation (which we’ve named execute) in the third compartment of the three transaction classes in the updated class diagram of Fig. 22.17. During an ATM session, the ATM object will invoke the execute operation of each transaction object to tell it to execute.

Image

Fig. 22.17. Classes ...

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.