Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Class(y) - <b>class messages</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    Class Messages
------------------------------------------------------------------------------

    Class messages should only be sent to a class object (see note below).
    A class message applies to the class as a whole, rather than to
    individual instances.  Sending a class message to a class object will
    cause the corresponding class method to be invoked.

    A class method can refer to class variables, or invoke other class
    methods.  The CLASS VAR and CLASS METHOD commands are used in
    the class declaration to declare these.

    A single copy of each class variable is shared among all the instances
    of a class.  A class method can access these class variables, via its
    self variable, which is always a class object.  This means that a
    class method cannot access instances variables belonging to its class
    via the self variable, since class methods are not associated with any
    particular instance.

    Note:

    Currently, Class(y) allows class messages to be sent to instances of a
    class as well as to class objects.  While the next version will support
    this for compatibility, it is not the recommended practice.  If you
    wish to send a class message and have only an instance of the class to
    work with, you can use a statement such as obj:class:message, in
    which the predefined class message is used to obtain a reference to
    the object's class object.  The message is then sent to the resulting
    class object, rather than directly to the original object.

See Also: CLASS VAR CLASS METHOD þ class

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson