[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Message Forwarding
Methods of the following form occur quite often in most programs:
METHOD foo( <params,...> )
RETURN ::someObj:foo( <params> )
Such methods can easily be replaced by a class declaration command such
as:
MESSAGE foo TO someObj
This eliminates the need to define a method.
Both of the above cases are examples of message forwarding. The latter
example, using the MESSAGE...TO command, is merely a more automatic
and efficient version of the former. As this example shows, message
forwarding can and should be used when all a method is doing is forwarding
a message on to a component object. Automatic message forwarding is simple
to implement, it saves code, executes faster, and can clarify the
relationship between a class and its component objects. Rather than having
to examine the methods of a class to determine its relationship to its
components, the class specification clearly identifies these
relationships, improving readability and allowing easier maintenance.
See the MESSAGE...[IS...] TO command for more information and examples
of defining forwarded messages.
Message forwarding is also used when implementing delegation. See
Delegation under Advanced Topics for more information.
See Also:
MESSAGE...[IS...] TO
Delegation
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson