title: How to return a class object by reference in C++?
body: <p>I have a class called Object which stores some data.</p>
  
  <p>I would like to return it by reference using a function like this:</p>
  
  <pre><code>    Object&amp; return_Object();
  </code></pre>
  
  <p>Then, in my code, I would call it like this:</p>
  
  <pre><code>    Object myObject = return_Object();
  </code></pre>
  
  <p>I have written code like this and it compiles.  However, when I run the code, I consistently get a seg fault.  What is the proper way to return a class object by reference?</p>