Naming

Despite the move to classes and object-orientation, not much has changed about how things are named. As before, types are prefixed with “a” or “an,” while formal arguments are prefixed with “the.” You can see how this makes it easy to understand the scope, source, and life span of variables and their content, and to distinguish a class declaration from an instance of the class.

In addition, use of the prefix “my” is continued, but in a slightly different context.

In the procedural Accumulator() function, myAccumulator was a static local variable whose life span was the same as the program. It provided Accumulator() with internal state and made it more like an object. In the case of classes, the prefix “my” is used for member variables, ...

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.