[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Delegation

  In object-oriented programming, the term delegation can be defined in
  various ways.

  At one end of the scale, message forwarding, in which an object
  forwards a message to another object, can be described as delegation, if
  the first object is delegating responsibility for responding to the
  message to the second object. Message forwarding is very simple to
  implement, using the MESSAGE...[IS...] TO command, as described in the
  section on Message Forwarding.

  At the other end of the scale, some (mostly academic or experimental)
  object-oriented languages use delegation to completely eliminate the need
  for classes or class inheritance. To achieve this, such languages usually
  handle the self variable differently. When the receiver of a delegated
  message (the delegatee) sends a message to self, the message is sent to
  the original delegator.

  Although class-based languages do not behave this way, this behavior is
  important in that it gives the delegatee a means of communicating with the
  delegator, allowing polymorphism to be achieved so that the delegator can
  override methods defined in the delegatee.

  Class(y) provides a facility to help simulate this behavior, by allowing
  messages to be sent to the sender, or delegator, of a message. This
  can be done in one of two ways: by using the SENDER() function to
  obtain a reference to the sender (delegator), or by using the
  MESSAGE...[IS...] TO SENDER command to define messages which are
  automatically forwarded to the sender.

  The following sections cover these topics in more detail.

See Also: Message Forwarding MESSAGE...[IS...] TO VAR...[IS...] TO
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson