Start here · Essential guide
Static Classes in C++
C++ has no static class keyword. Here is how static members, utility classes and namespaces cover the same job, with short code examples for each.
Classes and Design
How to get static class behavior in C++ and what static means in C.
Start here · Essential guide
C++ has no static class keyword. Here is how static members, utility classes and namespaces cover the same job, with short code examples for each.
C++ is statically typed, so the compiler checks types before the program runs. It still has some runtime type features, such as virtual functions.
A static class holds only static members and cannot be instantiated. C++ has no such keyword, but you can build the same effect with a class or a namespace.
In C, static keeps a local variable's value between function calls and limits a variable or function to its own file. A short example shows both uses.
Related topics