Different Actions

The fact that the same message may elicit different responses is illustrated by the following example. As we have seen, the message sendFlowers can be given to Fred, my florist, and will yield the desired result.

However, Chris can send the same message to Elizabeth, a mutual friend. She will accept the message, and the desired outcome will be produced. However, the actions performed by Elizabeth will be different from the actions performed by Fred. So we have the same message, but two different behaviors. The interpretation, that is the actions performed, differ depending upon who the message is given two.

As a third example, if I give the message to Ken the dentist, he will reject the message and issue a run-time error message. So, not all objects will accept all messages.

[audio] [real] Text to accompany slide21, in Chapter 1 of An Introduction to Object-Oriented Programming