I has this code:
struct A {
virtual void f() {}
};
struct B: A {
private:
void f() override {}
};
...
B b;
A& a = b;
a.f();
And ofcourse it will call f()
from B
cause private is checked on the compilation time but choosing virtual function version are in the runtime. Can I forbid f()
calling in this case?
Aucun commentaire:
Enregistrer un commentaire