title: How to work with variable in namespace
body: <p>I think I hvae a fundamental misunderstanding of namespace and/or static variable. But I have tried this test code (typed by hand, forgive typos)</p>
  
  <p>test.h:</p>
  
  <pre><code>namespace test{
     static int testNum=5;
     void setNum(int value);
  }
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>#include &lt;test.h&gt;
  
  int test::setNum(int value){
     testNum=value;
  }
  
  int main(){
      test::setNum(9);
      cout&lt;&lt;test::testNum;
  }
  </code></pre>
  
  <p>when I run this I get the value 5, not 9 as I would have expected.  It seems almost as if I have two instances of the testNum variable, but that seems to be the exact opposite of what static should be doing.  I'm guessing I've made a mistake in assuming that these features were identical to their java equvilants somehow...</p>
  
  <p>I also get an error stating that testNum is declared multuple times if I remove the static from my declaration of testNum, could someone explain why that is the case as well?</p>
  
  <p>Thank you</p>