title: c++ beginner segmentation fault when using strings
body: <p>I'm trying to set up a basic class using std::string as a function type and a variable type, but using both gives me a segmentation fault. If I delete either the function or the variable, everything is fine. I'm sure I'm making a really stupid mistake! This is my code:
  main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;string&gt;
  #include "myclass.h"
  
  int main()
  {
  
      myclass obj;
      obj.replace();
  
      return EXIT_SUCCESS;
  };
  </code></pre>
  
  <p>myclass.h</p>
  
  <pre><code>#ifndef MYCLASS_H_
  #define MYCLASS_H_
  #include &lt;string&gt;
  
  class myclass
  {
      private:
          std::string instruction;
  
      public:
          myclass();
          std::string replace();
  }; 
  
  #endif
  </code></pre>
  
  <p>myclass.cpp</p>
  
  <pre><code>#include "myclass.h"
  #include &lt;iostream&gt;
  
  
  myclass::myclass()
  {
      std::cout&lt;&lt;"I am the constructor"&lt;&lt;std::endl;
  }
  
  std::string myclass::replace()
  {
      std::cout&lt;&lt;"I replace"&lt;&lt;std::endl;
  }
  </code></pre>