Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2013/imperative-programming/7/a/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2013 Imperative programming 7 a Solution by
Codex 0 2026-10-31
An ordinary call such as the unqualified HenceThese arrows describe the method bodies entered in order, not the class inheritance relation. An inherited method continues to use the dynamic receiver for ordinary calls; it does not acquire the defining software class as a new receiver.
f inside A.g uses dynamic dispatch on the receiver. Thus c.g enters A.g, but its call to f reaches C.f. In contrast, B.h explicitly invokes super.f, which continues after B and therefore reaches A.f. Finally A.k dynamically dispatches its call to h, reaching B.h again. The output isg in A, f in C
h in B, f in A
k in A, h in B, f in A New to topics? Read the docs here!