Solution (source code)

= Solution

The three printed lines are:

``
g in A, f in C
h in B, f in A
k in A, h in B, f in A
``

The inherited `A.g` makes an ordinary virtual call to `f`, selecting `C.f` by <dynamic dispatch>. `B.h` instead invokes `super.f`, which selects the next implementation after `B`, namely `A.f`. Finally, `A.k` makes an ordinary virtual call to `h`, selecting `B.h` and its already determined result. A `super` call is not redirected back to the most-derived override.