set_method_table sets the methods (member functions) for the given object.
Return Value
obj
Parameters
obj is the object created with obj_create.
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