How should I choose where to store an object in C++?
<blockquote>
  <p><strong>Possible duplicate</strong><br />
  <a href="http://stackoverflow.com/questions/599308/proper-stack-and-heap-usage-in-c">Proper stack and heap usage in C++?</a></p>
</blockquote>

<p>I'm beginning to learn C++ from a Java background, and one big difference is the fact that I'm no longer forced to:</p>

<ol>
<li>dynamically allocate memory for objects
</li>
<li>always use pointers to handle objects
</li>
</ol>

<p>as is the case in Java.  But I'm confused as to when I should be doing what - can you advise?</p>

<p>Currently I'm tempted to start out doing everything Java-style like</p>

<pre><code>Thing *thing = new Thing();
thing-&gt;whatever();
// etc etc
</code></pre>
