title: Why can a static member function only be declared static inside the class definition and not also in its own definition?
body: <p>While implementing a class for creating/updating boxes on the screen, I wanted to add a static member function that makes sure no currently visible boxes overlap (taking its information from a static pointer array to all currently visible boxes)</p>
  
  <p>My initial code had the following structure:</p>
  
  <pre><code>class Box
  {
  public:
      // ...
      static void arrangeOverlappingBoxes();
  };
  
  static void Box::arrangeOverlappingBoxes()
  {
      // ...
  }
  </code></pre>
  
  <p>I was quite surprised that this generated an error C2724: 'static' should not be used on member functions defined at file scope.</p>
  
  <p>With some trial, google and error, I figured out that my function definition should lose the keyword <code>static</code>, i.e. it should be</p>
  
  <pre><code>void Box::arrangeOverlappingBoxes()
  {
      // ...
  }
  </code></pre>
  
  <p>Yet I have no clue what the rationale behind this could be. It appears to be so asymetric and confusing to have a different function header for its declaration in the class definition and its own definition. Is there any reason for this?</p>