title: Anonymous Namespace Class Definition
body: <p>I was looking over some (C++) code and found something like this:</p>
  
  <pre><code>//Foo.cpp
  namespace
  {
      void SomeHelperFunctionA() {}
      void SomeHelperFunctionB() {}
      void SomeHelperFunctionC() {}
  
      //etc...    
  
      class SomeClass //&lt;---
      {
          //Impl
      };
  }
  </code></pre>
  
  <p><code>SomeHelperFunction[A-Z]</code> are functions that are only needed in that translation unit, so I understand why they're in an anonymous <code>namespace</code>. Similarly, <code>SomeClass</code> is also only required in that translation unit, but I was under the impression that you could have classes with identical names in different translation units without any sort of naming collisions provided that you didn't have a global class declaration (e.g., in a commonly included header file).</p>
  
  <p>I should also mention that this particular translation unit does <strong>not</strong> include any headers that might declare a class with an identical name (<code>SomeClass</code>).</p>
  
  <p>So, given this information, could someone please shed some light on why the original programmer might have done this? Perhaps just as a precaution for the future?</p>
  
  <p>I'll be honest, I've never seen classes used in anonymous namespaces before.</p>
  
  <p>Thanks!</p>