title: C++ Static Function: Put Inside or Outside Scope of Class?
body: <p>Say I have a class as follows in a header file:</p>
  
  <pre><code>class A {
  public:
      void foo();
  }
  </code></pre>
  
  <p>The function <code>foo</code> needs to call another "helper" function named <code>bar</code>. Bar isn't needed anywhere else other than inside <code>foo</code>. Should it be defined statically outside the scope of <code>A</code>:</p>
  
  <p>(source file)</p>
  
  <pre><code>static void bar() { ... }
  void A::foo() {
      bar(); ...
  }
  </code></pre>
  
  <p>or within the class?</p>
  
  <p>(header)</p>
  
  <pre><code>class A {
  public:
      void foo();
  
  private:
      void bar();
  }
  </code></pre>
  
  <p>(souce)</p>
  
  <pre><code>void A::bar() { ... }
  void A::foo() {
      bar(); ...
  }
  </code></pre>