A constant value cannot change. A static variable exists to a function, or class, rather than an instance or object.
These two concepts are not mutually exclusive, and can be used together.
More Related Contents:
- Static constant string (class member)
- Why can’t I initialize non-const static member or static array in class?
- C++ where to initialize static const
- Differences with const keyword in C++
- Is it better in C++ to pass by value or pass by constant reference?
- How do I remove code duplication between similar const and non-const member functions?
- The static keyword and its various uses in C++
- Why does a static data member need to be defined outside of the class?
- Defining static members in C++
- Prevent static initialization order “fiasco”, C++
- C++ Const Usage Explanation
- Top-level const doesn’t influence a function signature
- When are static and global variables initialized?
- Does “const” just mean read-only or something more?
- Are function static variables thread-safe in GCC?
- Why does “extern const int n;” not work as expected?
- When to use const and const reference in function args?
- How to initialize a static const member in C++?
- constexpr static member before/after C++17
- Are static fields inherited?
- Why does C++ not have a const constructor?
- Calling a const function rather than its non-const version
- Why use a const member function?
- Is it allowed to cast away const on a const-defined object as long as it is not actually modified?
- Advantages of classes with only static methods in C++
- Is C++ static member variable initialization thread-safe?
- Should I still return const objects in C++11? [duplicate]
- Returning non-const reference from a const member function
- How is its lifetime of a return value extended to the scope of the calling function when it is bound to a const reference in the calling function?
- What is the meaning of ‘const’ at the end of a member function declaration?