title: What's the difference between a static member variable and a namespace variable?
body: <p>Whit is the difference between 1 and 2?</p>
  
  <p>1:</p>
  
  <pre><code>namespace Foo {
      int bar;
  }
  </code></pre>
  
  <p>2:</p>
  
  <pre><code>class Foo {
  public:
      static int bar;
  }
  </code></pre>
  
  <p>If <code>bar</code> is a function, then the difference is that <code>static class member</code> can access class <code>private</code> members. </p>
  
  <p>But sometimes we just need to store a <code>constant</code> for example. Then we have a choice. </p>
  
  <p>Is there any difference between these two? </p>
  
  <p>And what would be the reason to choose one over another. </p>
  
  <p>I have searched this, and I am surprised there's no answer already on the web.</p>