title: How to call C++ static method
body: <p>Is it possible to return an object from a static method in C++ like there is in Java? I am doing this:</p>
  
  <pre><code>class MyMath {
      public:
         static MyObject calcSomething(void);
      private:
  };
  </code></pre>
  
  <p>And I want to do this:</p>
  
  <pre><code>int main() { 
      MyObject o = MyMath.calcSomething(); // error happens here
  }
  </code></pre>
  
  <p>There are only static methods in the MyMath class, so there's no point in instantiating it. But I get this compile error:</p>
  
  <blockquote>
    <p>MyMath.cpp:69: error: expected primary-expression before '.' token</p>
  </blockquote>
  
  <p>What am I doing wrong? Do I <em>have</em> to instantiate MyMath? I would rather not, if it is possible.</p>