Message Passing

In Chapter 1 we presented a simple intuitive description of message passing. Recall that there were several ways in which message passing differed from a simple procedure call.

When a message is passed, it is always given to a specific object. This object is called the receiver for the message.

The class of the receiver will determine the particular method that will be invoked to handle the message. Different receivers may use different methods to respond to the same message.

When a method is invoked, the receiver is passed as an extra parameter as part of the call. This pseudo-variable is named self in Smalltalk and Object Pascal, named this in C++ and Java.

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