Back In the print window choose "Save as PDF" as the destination
NOTE.CS

const, static and inline

1 topic · 28 Nov 2026
1

const, static and inline

C++
  • 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++
void counter() {
    static int count = 0;   // initialised only once
    count++;
    cout << count << " ";
}
// counter(); counter(); counter();  →  1 2 3