What is the difference between a static and const variable?

jaimin picture jaimin · Feb 7, 2010 · Viewed 129.8k times · Source

Can someone explain the difference between a static and const variable?

Answer

Stefan Kendall picture Stefan Kendall · Feb 7, 2010

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.