const
Applies to: cpp
const marks something as not modifiable, and the compiler enforces it. A const parameter, variable, or
member function documents intent and prevents accidental change. Marking every read-only method const is called
const-correctness.
double area() const { return w * h; } // promises not to change the object
const double PI = 3.14159265358979; // a constant
See also: reference