Trying to have an object collide and delete another object in C++
<p>So I have an assignment that requires me to have a collision happen between the Player object and an Object (a cube/pyrmaid/sphere really doesn't matter which) using a Octree for my collision calculations. Upon the collision of the Player with the Object the object needs to be deleted. I have a function as such</p>

<pre><code>void BinPart::ProcessCollisions(int &amp;nbrTests, int &amp;nbrCollisions){
    if(hasChildren())
    {
        for(int i = 0; i &lt;= 7; i++)
        {
        child[i]-&gt;ProcessCollisions(nbrTests, nbrCollisions);
        }
    }
    int n = objects.size();

    if(n &gt;= 2)
    {
        for(int i = 0; i &lt; n - 1; i++)
        {
            for(int j = i + 1; j &lt; n; j++)
            {
                nbrTests++;
                if(player-&gt;collidesWith(objects[j]))
                {
                    objects.erase(objects.begin() + j);
                }
                else
                {
                    if(objects[i]-&gt;collidesWith(objects[j]))
                        {
                            nbrCollisions++;
                        }
                }
            }
        }
    }
    if(n &gt;= 1 &amp;&amp; parent != NULL)
    {
        parent-&gt;ProcessBorderCollisions(this, nbrTests, nbrCollisions);
    }
}
</code></pre>

<p>currently the <code>player-&gt;collidesWith(objects[j]);</code> does not work because player is "undefined" in the header file for binPart theres a forward declaration of a base class of type Object of which all the objects are being made from. The Object *player however is in the Game.h but I need the binPart to be able to access it. I've asked one of my friends on my course what he has and his is almost identical to mine which raises questions. If theres any more info needed let me know.</p>
