The main.cpp

main.cpp (see Listing 20.9) instantiates everything, hands the objects over to aController, and then starts the Calculator operating.

Listing 20.9. main.cpp
 1: #include "ExternalInterfaceModule.h"
 2: #include "AccumulatorModule.h"
 3: #include "TapeModule.h"
 4: #include "ControllerModule.h"
 5:
 6: int main(int argc, char* argv[])
 7: {
 8:    SAMSCalculator::anExternalInterface ExternalInterface;
 9:    SAMSCalculator::anAccumulator          Accumulator;
10:    SAMSCalculator::aTape                  Tape;
11:
12:    SAMSCalculator::aController            Calculator
13:    (
14:       ExternalInterface,
15:       Accumulator,
16:       Tape
17:    );
18:
19:    return Calculator.Operate();
20: }

Lines 8–10 ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.