Say class B
derives from class A
. That both declare f()
. f is protected. Hence f will only be called inside A
and inside B
. Does f()
need to be declared virtual?
Or rather: say C
derives from B
derives from A
. B
and A
declare protected non-virtual f()
. Will a call to f()
in C
and B
resolve to B::f()
and in A to A::f()
?
In that case, should we always avoid virtual for protected members to have static resolution? Is this done automatically? Thanks!