Hi,
When I read Effective C++, it says, never redefine a non-virtual function in C++.
However, when I tested it, the code below compiles correctly. So what's the point? It's a mistake or just a bad practice?
class A {
public:
void f() { cout<<"a.f()"<<endl;};
};
class B: public A {
public:
void f() { cout<<"b.f()"<<endl;};
};
int main(){
B *b = new B();
b->f();
return 0;
}