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