redefine a non-virtual function in C++
<p>When I read Effective C++, it says, never redefine a non-virtual function in C++. </p>

<p>However, when I tested it, the code below compiles correctly. So what's the point? It's a mistake or just a bad practice? </p>

<pre><code>class A {

    public:
    void f() { cout&lt;&lt;"a.f()"&lt;&lt;endl;};   
};

class B: public A {
    public:
    void f() { cout&lt;&lt;"b.f()"&lt;&lt;endl;};   
};


int main(){

    B *b = new B();
    b-&gt;f(); 
    return 0;
}
</code></pre>
