home > resources > c++ coding standard > online version

Class Member Names

  • Member names should be prepended with the character 'm'.
  • Member the 'm' use the same rules as for class names.
  • 'm' always precedes other name modifiers like 'p' for pointer.

Justification

  • Prepending 'm' prevents any conflict with method names. Often your methods and attribute names will be similar, especially for accessors.

Example 2-4. Class Member Names Example

class NameOneTwo
{
public:
    int     varAbc();
    int     errorNumber();
private:
    int     mVarAbc;
    int     mErrorNumber;
    String  *mpName;
}