title: C++ class functions compared to C#
body: <p>I am learning C++ at the moment, and I came across a lot of examples where classes are declared differently than I'm used to in for example C# or Java. The following thing isn't clear to me:</p>
  <p>When defining a class in C#, you code the methods that you are going to use entirely within the class, like so:</p>
  <pre><code>public class example{
   public example(){}
  
  public void doSomething(){
   Console.WriteLine(&quot;This is something&quot;);
  }
  
  }
  </code></pre>
  <p>The method &quot;doSomething()&quot; can be accessed by instantiating a new object, and calling object.doSomething();. All clear to me.</p>
  <p>Why do people do the following in C++?:</p>
  <pre><code>class example{
  
  private: 
   int _thingy;
  
  public:
   void doSomething();
  
   }
  
  #include &lt;iostream&gt;
  
  example::doSomething(){
   std::cout &lt;&lt; _thingy;
  }
  
  int main(){
   example x;
   x.doSomething();
   system(&quot;pause&quot;);
  }
  </code></pre>
  <p>Isn't this bad when you are going to reuse the class in other methods?</p>