Algorithm 5.1 Method-Dispatch-Of-Virtual-Calls

Input: Type cc of receiver object and method signature mm at call site.

Output: The signature of target method.

1:procedure Dispatch(c,mc,m)

2:if cc contains non-abstract method mm' that has the same name and descriptor as mm then

3:return mm'

4:else

5:Let cc' be the superclass of cc.

6:return Dispatch(c,mc', m)

7:end if

8:end procedure