push_back(this) pushes wrong pointer onto vector
<p>I have a vector of UnderlyingClass pointers stored in another object, and inside a method in UnderlyingClass I want to add the "this" pointer to the end of that vector.  When I look at the contents of the vector immediately after the push_back call, the wrong pointer is in there.  What could be going wrong?</p>

<pre><code>cout &lt;&lt; "this: " &lt;&lt; this &lt;&lt; endl;
aTextBox.callbacks.push_back(this); 
cout &lt;&lt; "size is " &lt;&lt; aTextBox.callbacks.size() &lt;&lt; endl;
cout &lt;&lt; "size-1: " &lt;&lt; aTextBox.callbacks[aTextBox.callbacks.size()-1] &lt;&lt; endl;
cout &lt;&lt; "back: " &lt;&lt; aTextBox.callbacks.back() &lt;&lt; endl;
cout &lt;&lt; "0: " &lt;&lt; aTextBox.callbacks[0] &lt;&lt; endl;
cout &lt;&lt; "this: " &lt;&lt; this &lt;&lt; endl;
cout &lt;&lt; "text box ptr: " &lt;&lt; &amp;aTextBox &lt;&lt; endl;
cout &lt;&lt; "text box callbacks ptr: " &lt;&lt; &amp;(aTextBox.callbacks) &lt;&lt; endl;
</code></pre>

<p>Here's the output:</p>

<pre><code>this: 0x11038f70
size is 1
size-1: 0x11038fa8
back: 0x11038fa8
0: 0x11038fa8
this: 0x11038f70
text box ptr: 0x11039070
text box callbacks ptr: 0x11039098
</code></pre>

<p>By the way, callbacks is a vector of WebCallback pointers, and UnderlyingClass implements WebCallback:</p>

<pre><code>std::vector&lt;WebCallback*&gt; callbacks;


class UnderlyingClass
    :public WebCallback
</code></pre>

<p>Copied from comments: (see Answer below)</p>

<p>output:</p>

<pre><code>this: 0x6359f70 
size is 1 
size-1: 0x6359fa8 
back: 0x6359fa8 
0: 0x6359fa8 
this: 0x6359f70 
WebCallback This: 0x6359fa8 
text box ptr: 0x635a070 
text box callbacks ptr: 0x635a098
</code></pre>

<p>okay, so that explains why the pointers don't match up.</p>

<p>My real question, then, is this:</p>

<p>how do I get the correct version of a method to be called? Specifically, WebCallback stipulates that a function onWebCommand() be implemented, and right now callbacks[0]->onWebCommand() is not causing the onWebCommand() that I wrote in UnderlyingClass to be executed.</p>
