title: Why does public const not imply static?
body: <p>In C# const implies static so you can reference a public const without having to reference an instance of  a class or struct. In C++ this is not the case. If you want to access a const member variable in C++ you need to first have a reference to an instance of the class. In C++ as far as I can tell making a member variable const causes its data to be either replaced with an literal value or stored in the text or data segment (depending on the compiler) of the program. So my question is, if const member variables are allocated only once for a given class (not per instance) and stored in an area separate from instance specific member data, why can't you access a public const class member variable without a reference to an instance of the class such as:</p>
  <pre><code>struct Example {
     const int array[] = {1, 2, 3};
  };
  
  void main() {
     std::cout &lt;&lt; Example::array[1];
  }
  </code></pre>
  <p>Instead you need to make them a static const and initialize them outside of the class such as:</p>
  <pre><code>struct Example {
     static const int array[3];
  };
  
  const int Example::array[3] = {1, 2, 3}
  
  void main() {
     std::cout &lt;&lt; Example::array[1];
  }
  </code></pre>