Next: Variables and Parameters
Prev: Inheritance
C-- method, see Sending Messages.
Coldmud processes a message by looking on the recipient object and its
ancestors for a method with the same name as the message, following the
rules given in the previous section. The recipient's method processes
the message according to its C-- instructions, and returns a
value to the calling object.
While a message is being processed, the object which received the message is called the current object. Only the current object's variables can be accessed or changed by the method which processes the message; to examine or modify another object, the method must send a message to that object.
If a method definition overrides a definition on an ancestor of the current object with lower precedence, the overriding method can pass the message to the ancestor; see Passing Messages for details.
Methods can use the functions this() and sender() to
determine the dbrefs of the current object and the object which sent the
message to the current object. The functions definer() and
caller() allow methods to determine the dbrefs of the objects
which define the current method and the calling method.
Messages to an object are not always sent by another object; they can
also come from the server. Coldmud sends parse, connect,
and disconnect messages to handler objects of connections,
startup and heartbeat messages to the system object, and
connect and failed messages to receiver objects of pending
connections generated by the connect() function. When Coldmud
sends a message to an object, sender() and caller() return
the integer 0.