C++ object instantiation and scope
<p>I'm coming (very recently) from C#, where I am used to instantiating objects like this:</p>

<pre><code>Phone myPhone = new Phone();
</code></pre>

<p>simply writing </p>

<pre><code>Phone myPhone;
</code></pre>

<p>essentially creates a holder for a class, but it is yet to be initialised so to speak.</p>

<p>now I'm writing a small class in C++ and I have a problem. Here is the pseudo code:</p>

<pre><code>Phone myPhone;

void Initialise()
{
    myPhone = new Phone();
}

void DoStuff()
{
    myPhone.RingaDingDong();
{
</code></pre>

<p>In fact this is a little misleading as the above code is what I would LIKE to have, because I want to be able to put all my initialisation code for lots of things into one neat place. My problem is that the line inside initialise is unnecessary in C++, because before that, a new instance is already created and initialised by the very first line. On the other hand if I put the just the first line inside Initialise() I can no longer access it in DoStuff. It is out of scope, (not to mention the differences between using 'new' or not in C++). How can you create simply a holder for a class variable so I can initialise it in one place, and access it in another? Or am I getting something fundamentally wrong?</p>

<p>Thanks in advance!</p>
