[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
VAR...[IS...] TO
Synopsis
Forward variable's messages (assign and access)
Syntax
VAR <variable name> [IS <target name>]
TO <target variable>
Arguments
<variable name> is the name of the 'variable' being declared.
In fact, this command does not declare a variable but rather
allows access to a variable in another object.
<target name> is the name of the variable, in the target
class, which <variable name> will be mapped to. This argument
should be omitted if its value is the same as <variable name>.
<target variable> is the name of the instance variable that
the variable messages being declared will be forwarded to. The
target variable must be a member of the current class or of a
superclass. Two special keywords can be used instead of specifying
a target variable: CLASS <className> and SENDER. Their use
is described in the entry for the MESSAGE...[IS...] TO
command.
Description
This command causes the specified variable's access and assignment
messages to be forwarded to the object contained in the specified
target variable. This makes it appear as though the variable
exists in the class in which this command is used.
Example
CLASS Graph
VAR oWin // refers to Window object
EXPORT:
VAR nGraphTop IS nTop TO oWin
// ...
END CLASS
This class specification will cause instances of the Graph class,
upon receiving the nGraphTop message for access or assign, to
respond by sending the equivalent nTop message to the object
referred to by the instance variable oWin. Thus, for example,
the following code has the ultimate effect of assigning the number
5 to the nTop variable in the Window object contained in the Graph
object oGraph.
LOCAL oGraph := Graph():new(...)
oGraph:nGraphTop := 5
? oGraph:nGraphTop
See Also
MESSAGE...[IS...] TO, Message Forwarding
See Also:
MESSAGE...[IS...] TO
Message Forwarding
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson