O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required