title: C++ using namespaces to avoid long paths
body: <p>I am still learning C++, and I have never really created my own namespaces before.  I was experimenting with them and while I got most things to work, there's one thing that I still can't seem to do.  I would like to be able to call a static method within a class without typing something like <code>NameOfClass::method</code>.  Here is what I thought the code should look like, but it fails to compile:</p>
  
  <p>File <code>A.h</code>,</p>
  
  <pre><code>namespace Test
  {
      class A
      {
          public:
              static int foo() { return 42; }
      };
  }
  </code></pre>
  
  <p>File <code>main.cpp</code>,</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  #include "A.h"
  
  using namespace std;
  using namespace Test::A;
  
  int main()
  {
      cout &lt;&lt; foo() &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>The compiler gives me:</p>
  
  <pre><code>main.cpp:6: error: ‘A’ is not a namespace-name
  main.cpp:6: error: expected namespace-name before ‘;’ token
  main.cpp: In function ‘int main()’:
  main.cpp:10: error: ‘foo’ was not declared in this scope
  </code></pre>
  
  <p>Is it possible to do what I am trying to do without typing <code>A::foo</code>?</p>