Object Instantiation

Top  Previous  Next

Code blocks can create new objects based on a class with the new() function.  Each object is a simple numeric variable.  The new() function returns an object ID number, and all action on that object is processed through the numeric variable.

 

There can be any number of objects in memory at a given time.  Each object that is created is unique, with its own data.

 

The syntax of the new() function is:

 

objvar=new("classname"[,arg1[$],…][,err=label|*next)

 

When this function is executed in a code block, a new object is created and assigned to objvar.  Some objects accept arguments during this initialization step, and the arguments are provided in a comma-separated list after the class name.

 

If an error occurs during the object creation, the object is not created, and the err=label is executed.