virtual function default arguments behaviour
<p>I have a strange situation over the following code. Please help me to get it clarified.</p>

<pre><code>class B
{
       public:
            B();
            virtual void print(int data=10)
            {
                  cout &lt;&lt; endl &lt;&lt; "B--data=" &lt;&lt; data;
            }
};
class D:public B
{
       public:
            D();
            void print(int data=20)
            {
                  cout &lt;&lt; endl &lt;&lt; "D--data=" &lt;&lt; data;
            }
};

int main()
{
     B *bp = new D();
     bp-&gt;print();
return 0;
}
</code></pre>

<p>Regarding the output I expected</p>

<pre><code>[ D--data=20 ]
</code></pre>

<p>But in practical it is</p>

<pre><code>[ D--data=10 ]
</code></pre>

<p>Please help. It may seem obvious for you but I am not aware of the internal mechanism.</p>
