341 : 7 Mar 2002 : Semantics of message sends

Consider the following class hierarchy:

Object subclass: #A
   ...

  "Methods of A"
  g
      ^ 'dog"

A subclass: #B
  ...

  "Methods of B"
  h
      ^ self g

B subclass: #C
  ...

  "Methods of C"
  f
      ^ super g
  g
      ^ 'cat'
  i
      ^ self h

C subclass: #D
  ...

  "Methods of D"
  h
      ^ 'mouse'
  i
      ^ super i

The semantics of method dispatch are as follows:

What are the values of the following expressions? (Try them in Squeak if you can't figure them out.)

(D new) h.
(D new) f.
(C new) h.
(C new) i.
(D new) i.

cse341-webmaster@cs.washington.edu
Last modified: Thu Mar 7 12:36:37 PST 2002