Will the pointer ever be different than expected in this case?
<p>Say I have a Listener class.</p>

<p>I have class A and class M which both implement the listener class.
Class A has 4 M's.</p>

<p>Each M has 1 A, but not as an A, as a Listener base class. (So downcasted A because M knows nothing about A).</p>

<p>When A gets a message from 1 of them M's it needs to be able to know which M sent it.</p>

<p>Therefore, every method in the Listener class has a Listener* parameter.</p>

<p>so if I have something like this:</p>

<pre><code>void A::someListenerMethod(Listener* l, MsgEnum msg)
{
    if(l == m_mInstance[0])
    {
       //will this work if the caller was indeed the M instance in question?
    }

}
</code></pre>

<p>So essentially what I'm asking is, do I need to downcast the M's to Listeners before comparing them?</p>

<p>I read that sometimes C++ will make a separate object for a sub class for multiple inheritance. There is no multiple inheritance in this case, but I want to make sure this will work.</p>

<p>Thanks</p>
