31
  • const — value cannot change after initialisation. A const member function cannot modify the object.
  • static local variable — keeps its value between function calls.
  • static member — one copy shared by all objects of the class.
  • inline — asks the compiler to paste the function body at the call site to avoid call overhead (for small functions).
C++ 6 lines
void counter() {
    static int count = 0;   // initialised only once
    count++;
    cout << count << " ";
}
// counter(); counter(); counter();  →  1 2 3