Skip to content

The static keyword

There are 5 different ways of using the static keyword in total.

  • Defining a variable in a function.
  • Defining member variable.
  • Defining a global variable.
  • Defining a member function.
  • In anonymous union. (less common)

Defining a variable in a function.

Defining member variable.

Defining a global variable.

Defining a member function.