DIMAJIX - software consulting (http://www.dimajix.de/)
 

Naming


Rule 33. Every class name is a substantive and starts with a capital letter.

This rule again emphasises the idea that classes as some sort of meta objects (as they can instantiate objects) begin with capital letters whereas objects and variables themselves start with lowercase letters.


Rule 34. Every class method name is a verb and starts with a lowercase character.

Methods are a special form of functions and therefore they should obey to the same rules as functions did.


Rule 35. Every class member variable starts with a lowercase ''m_'' followed by a capital letter.

This little prefix helps to distinguish between local and member variables in the implementation of methods plus it avoids a name clash between member variables and member functions.

For an application of all three rules above, consider the following example:

class Car {
private:
    float       m_Speed;
    float       m_Direction;
    bool        m_Locked;
    
public:
    bool        lock();
    bool        unlock();
     
    void        setSpeed(float );
    float       getSpeed() const;
    
    void	        setDirection(float );
    float       getDirection() const;
};



Kaya Memisoglu 2005-01-06