title: C++ accessing global variables/objects in a namespace with a variable/object with the same name
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  string a;
  
  namespace myNamespace
  {
      string a;
      void output()
      {
          cout &lt;&lt; a &lt;&lt; endl;
      }
  }
  
  int main()
  {
      a = "Namespaces, meh.";
      myNamespace::a = "Namespaces are great!";
      myNamespace::output();
  }
  </code></pre>
  
  <p>The result is "Namespaces are great!".  So is there any way to access the global string a inside of the namespace myNamespace instead of just the local one?</p>