Moving Function Content into Member Functions

In the implementation of anAccumulator, you moved the content of the Accumulator() function into the Apply() function with minimal changes. Next, take a look at the header and implementation files for aController, which embodies much of what used to be in the Calculator() function (see Listings 19.4 and 19.5).

Listing 19.4. aController Header
 1: #ifndef ControllerModuleH 2: #define ControllerModuleH 3: 4: #include "ExternalInterfaceModule.h" 5: #include "AccumulatorModule.h" 6: #include "TapeModule.h" 7: 8: namespace SAMSCalculator 9: { 10: class aController 11: { 12: public: 13: 14: aController 15: ( 16: anExternalInterface &theExternalInterface, 17: anAccumulator &theAccumulator, 18: aTape &theTape ...

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.