...
In this compliant solution, the upcast is removed, rendering the initial code ill-formed and emphasizing the underlying problem: that B::g()
does not exist. This compliant solution assumes that the programmer's intention was to use the correct dynamic type for the underlying object:
...