title: Whats the Difference between a . and -> in calling a Method in C++
body: <p>Can you tell me the difference between a . and -> call to a method in C++.  </p>
  
  <p>This code works fine, using both calling methods.  </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class myclass
  {
      public:
      string doSomething();
  };
  
  
  string myclass::doSomething()
  {
      return "done something\n";
  }
  
  int main (int argc, const char * argv[])
  {
      myclass c;
      std::cout &lt;&lt; c.doSomething();
  
      myclass *c2;    
      std::cout &lt;&lt; c2-&gt;doSomething();
  
      return 0;
  }
  </code></pre>
  
  <p>I don't understand the different between the 2 calls?  they both work? </p>