Function overloading with base and derived class references
<p>I have the following classes:</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

class M
{
};

class N:public M
{
};

class A
{
    public:
        virtual void f(M&amp; m)=0;
};

class B:public A
{
    public:
        void f(M&amp; m){cout&lt;&lt;"using M version"&lt;&lt;endl;}
        void f(N&amp; n){cout&lt;&lt;"using N version"&lt;&lt;endl;}
};
</code></pre>

<p>and the following implementation:</p>

<pre><code>int main()
{
    N n;
    A &amp;o = *new B();
    o.f(n);
    //o.f(static_cast&lt;N&amp;&gt;(n));
}
</code></pre>

<p>Basically I want "void f(N&amp;)" to be implemented instead of "void f(M&amp;)" when calling "o.f(n)", but not sure how to achieve it.</p>
