# class

Defines a new object class

Syntax

    class(<class>,<base_name>)
    {
        <function_name>[([<parameter reminder>])]
        {
            <function body>
        }
        ...
    }

Description

Defines a new implementation of the class <class>. If an implementation of that class was already existing it is removed with all the derived classes (and all the instances of this class and the derived ones are destroyed). <base_name> is the name of the class that the new class has to inherit from.
Note:
The keywords "function" and "event" that were used in KVIrc versions previous to 3.0.0 have been removed since "useless".
The <parameter reminder> part is an optional string that can be used to sign the parameters that the function expects; it acts as a programmer reminder or comment and it has no other meaning in KVIrc scripting. The <parameter reminder> respects the syntax of an expression, so it is terminated by a closed parenthesis. It's rather dangerous to use this command inside an object function handler: if the class definition <class> was already existing and it is a parent of the object's class, you might end up executing "inexisting" code.
As a thumb rule, use this command only outside object function handlers.

Examples

        class(myclass,object)
        {
            constructor
            {
                echo Hey this is my constructor
                echo I have been just created
            }
            destructor
            {
                echo Ops...being destroyed
            }
            sayHello(this function expects no parameters)
            {
                echo Hello world!
            }
        }

See also
privateimpl, killclass, clearobjects, $classDefined(), Objects documentation

Index, Commands

KVIrc 3.2.0 Documentation
Generated by root at Mon Mar 13 07:05:21 2006