Class Notation

As you saw earlier, there are two parts to a class: the class declaration, which goes in the module header file, and the class definition, which goes in the module implementation file.

The class declaration for a simple class, such as aRequest, shows most of the notation used for a class definition (see Listing 19.1).

Listing 19.1. aRequest Header
 *1: #ifndef RequestModuleH *2: #define RequestModuleH 3: *4: namespace SAMSCalculator *5: { *6: class aRequest *7: { 8: public: 9: *10: enum anOperator *11: { *12: add, *13: subtract, *14: multiply, *15: divide, *16: query, *17: reset, *18: selftest, *19: querytape, *20: stop *21: }; 22: 23: // Note: There is no default constructor 24: // you must provide an operator and operand when ...

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.