Class properties

Data members that that store a simple value.

Class data members that act like user-accessible properties are declared with private access. As with all private data members, they end with an underscore. The class provides a pair of methods for accessing each property–one for reading the property and one for modifying the property. Some properties are read-only in which case only the writer is provided.

All writer properties return a reference to the object that is modified so that property settings can be chained. If the class uses the reference-counting smart-pointer paradigm, then a pointer to the object is returned instead. (See Reference counting smart pointers).

class SomeClass {
int someProperty_;
int someProperty() const {
return someProperty_;
SomeClass& someProperty(int someProperty) {
someProperty_ = someProperty;
return *this;
Collaboration diagram for Class properties: