title: C++ Overload Static Function with Non-Static Function
body: <p>I would like to print two different things depending on whether a function is called statically with <code>Foo::print()</code> or from an instance of <code>Foo foo; foo.print();</code></p>
  
  <p>EDIT: Here is a class definition that definitely does not work, as answered by a few people already.</p>
  
  <pre><code>class Foo {
      string bla;
      Foo() { bla = "nonstatic"; }
  
      void print() { cout &lt;&lt; bla &lt;&lt; endl; }
      static void print() { cout &lt;&lt; "static" &lt;&lt; endl; }
  };
  </code></pre>
  
  <p>However, is there a good way of achieving this effect? Basically, I would like to do:</p>
  
  <pre><code>if(this is a static call)
      do one thing
  else
      do another thing
  </code></pre>
  
  <p>Phrased in another way, I know PHP can check if the <code>*this</code> variable is defined or not to determine whether the function is called statically. Does C++ have the same capability?</p>