title: C++ What is wrong with using a toString() method
body: <p>I just came across <a href="https://stackoverflow.com/questions/5171739/tostring-override-in-c">this question</a> which is about how to be able to print an object via</p>
  
  <pre><code>std::cout &lt;&lt; x &lt;&lt; std::endl;
  </code></pre>
  
  <p>As I understood, the standard way to accomplish this is to overload the ostreams &lt;&lt; operator. However, this is adding a feature to the ostream rather than to my class. </p>
  
  <p>The alternative (also given as answer to the above mentioned question) is to override the string conversion operator. However, this comes with the warning of leading to "unintentional conversions and hard-to-trace bugs".</p>
  
  <p>Now i wonder if there are any drawbacks of writing a toString() method and then using it via</p>
  
  <pre><code>std::cout &lt;&lt; x.toString() &lt;&lt; std::endl;
  </code></pre>