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

Static Member Variables and Functions in Classes

A quick look at main() in Listing 24.5 shows how it uses the instance-counting feature.

Listing 24.5. Main.cpp Using isInstanceCountable::TotalNumberOfInstances()
 1: #include <iostream> 2: 3: #include "ConsoleAndPersistentTapeExternalInterfaceModule.h" 4: #include "BasicAccumulatorModule.h" 5: #include "PersistentTapeModule.h" 6: #include "ControllerModule.h" 7: #include "InstanceCountableModule.h" 8: 9: using namespace std; 10: 11: int main(int argc, char* argv[]) 12: { 13: SAMSCalculator:: aConsoleAndPersistentTapeExternalInterface 14: ExternalInterface(argv[1]); 15: 16: SAMSCalculator::aBasicAccumulator Accumulator; 17: SAMSCalculator::aPersistentTape Tape(argv[1]); 18: 19: SAMSCalculator::aController ...

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