title: Why can't I put a "using" declaration inside a class declaration?
body: <p>I understand the troubles you can get into when you put a <code>using</code> declaration inside a header file, so I don't want to do that.  Instead I tried to put the <code>using</code> (or a <code>namespace foo =</code>) within the class declaration, to cut down on repetitive typing within the header file.  Unfortunately I get compiler errors.  Seems like it would be a useful feature.</p>
  
  <pre><code>#ifndef FOO_H
  #define FOO_H
  
  // This include defines types in namespace gee::whiz::abc::def,
  // such as the class Hello.
  #include "file_from_another_namespace.h"
  
  // using namespace gee::whiz::abc::def; // BAD!
  
  namespace x {
     namespace y {
        namespace z {
  
  struct Foo {
      using namespace gee::whiz::abc::def; // Illegal.
      namespace other = gee::whiz::abc::def; // Illegal.
  
      // Foo(gee::whiz::abc::def::Hello &amp;hello); // annoyingly long-winded
  
      Foo(other::Hello &amp;hello); // better
      //...
  };
  
  } } } // end x::y::z namespace
  
  #endif // FOO_H
  </code></pre>
  
  <p>In the real code, the namespace names are much longer and annoying and it's not something I can change.</p>
  
  <p>Can anyone explain why this is not legal, or (better) if there's a workaround?</p>