Defining an inherited non-virtual function will produce unpredictable behavior.
1 | class B { |
As you can see, depend on which pointer the mf
is called from, it calls different mf
function. This is really bad because the behavior of such function call is unpredictable.