What is the preferred way to instantiate in C++?
<p>I am still new to C++. I have found that you can instantiate an instance in C++ with two different ways:</p>

<pre><code>// First way
Foo foo;
foo.do_something();

// Second way
Baz *baz = new Baz();
baz-&gt;do_something();
</code></pre>

<p>And with both I don't see big difference and can access the attributes. Which is the preferred way in C++? Or if the question is not relevant, when do we use which and what is the difference between the two?</p>

<p>Thank you for your help.</p>
