title: Creating a C++ namespace in header and source (cpp)
body: <p>Is there any difference between wrapping both header and cpp file contents in a namespace or wrapping just the header contents and then doing <strong>using namespace</strong> in the cpp file?</p>
  
  <p>By difference I mean any sort performance penalty or slightly different semantics that can cause problems or anything I need to be aware of.</p>
  
  <p>Example:</p>
  
  <pre><code>// header
  namespace X
  {
    class Foo
    {
    public:
      void TheFunc();
    };
  }
  
  // cpp
  namespace X
  {
    void Foo::TheFunc()
    {
      return;
    }
  }
  </code></pre>
  
  <p>VS</p>
  
  <pre><code>// header
  namespace X
  {
    class Foo
    {
    public:
      void TheFunc();
    };
  }
  
  // cpp
  using namespace X;
  {
    void Foo::TheFunc()
    {
      return;
    }
  } 
  </code></pre>
  
  <p>If there is no difference what is the preferred form and why?</p>