Storing current object in c++
<p>I want to store the currently selected object (selected by mouse click) and then implement methods on this object. The currently selected object is chosen from an array:</p>

<pre><code>for(int i=0; i&lt;trackList.size(); i++)
{
    trackList[i].setSelected(false);
    if((trackList[i].isClicked(x,y)) &amp;&amp; (!trackList[i].isSelected()))
    {
        trackList[i].setSelected(true);
        currentSelected = trackList[i];
    }
}
</code></pre>

<p>I am new to C++ and have read up on pointers etc. but I am struggling to understand where and how they should be used. Do I need to have my currentSelected object as a pointer to whatever trackList[i] is?</p>

<p>Can I then implement methods on this object using the pointer reference?</p>

<p>Many thanks</p>

<p>EDIT:
trackList is storing a vector of Track objects:</p>

<pre><code>std::vector&lt;interface1::Track&gt; trackList;
</code></pre>

<p>And currentSelected is storing a Track object which I want to apply methods to:</p>

<pre><code>interface1::Track* currentSelected;
</code></pre>
