Elements of OOP - Receivers

A message can be constrasted with a function call in a conventional programming language. Both mechanisms are a means for abstracting, encapsulating, and naming a desired behavior. However, messages and function calls differ in two very important respects. A function exists on its own. It may take values as arguments, but the function can be thought of as an independent entity. A message, on the other hand, is always given to a receiver. Thus, there is an object that is accepting responsibility for the message.

Furthermore, and more importantly, the interpretation of the message may be different, depending upon the receiver. The same message given to two different receivers may elicit two different types of responses.

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