Sams Teach Yourself C++ in 21 Days

(singke) #1

  • Account

  • Receipts

  • ATM (machine)

  • Network
    This is not a bad way to start, as far as it goes. You might then go on to diagram the
    obvious relationships among some of these classes, as shown in Figure 11.12.


352 Day 11


FIGURE11.12
Preliminary classes.

Checking Account

Account

AT M

Cash Receipt

Customer

Network

Dispenses Dispenses

Transformations ..............................................................................................


What you began to do in the preceding section was not so much extract the nouns from
the scenario as to begin transforming objects from the domain analysis into objects in the
design. That is a fine first step. Often, many of the objects in the domain have surrogates
in the design. An object is called a surrogate to distinguish between the actual physical
receipt dispensed by an ATM and the object in your design that is merely an intellectual
abstraction implemented in code.
You will likely find that mostof the domain objects have a representation in the design—
that is, a one-to-one correspondence exists between the domain object and the design
object. Other times, however, a single domain object is represented in the design by an
entire series of design objects. And at times, a series of domain objects might be repre-
sented by a single design object.
Free download pdf