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>creating instances</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    Creating Instances
------------------------------------------------------------------------------

    A class object is needed whenever a new instance of its class needs to
    be created.  New instances of a class are created by sending a
    constructor message (see Constructor Messages and Methods) to its class
    object.  For example, to create a new instance of the Window class, we
    would typically use code such as the following:

        obj := Window():new(5, 10, 15, 70)

    What we are doing here is calling the class function (in this case
    Window()) to obtain a reference to the class object for the Window
    class, and sending a constructor message (in this case new) to the
    class object.  The invoked new method initializes the new object
    according to the parameters it is given, and returns the object to the
    caller, where it is assigned to the variable obj.

See Also: Constructor Messages and Methods

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