Previous topic

set_math_lib

Next topic

SetClipboardText

This Page

set_method_tableΒΆ

set_method_table sets the methods (member functions) for the given object.

obj = set_method_table(obj, ssClass)
obj = set_method_table(obj, ssClass, bUpdate)

Return Value

obj

Parameters

obj

obj is the object created with obj_create.

ssClass

Example

def my_obj_print(this)
{
    k = this.keys
    for (i in 1:len(k)) {
        printf("%s = ", k[i]);
        print this[k[i]]
    }
}
def my_methods()
{
    return [.
        print = "my_obj_print",
        __print__ = "my_obj_print"];
}
def my_create()
{
    this = [.];
    set_method_table(this, "my");
    return this;
}
o = my_create();
o.a = 1;
o.b = 2;
o
print o
o.print()

id-1586543