The equivalent of the C++ "new" keyword is the function crx_new() / crxOop.crx_new(). The function is the only
way to create class instances. The function provides four overrides which allow the creation of single or multiple
instances. All four overrides allow the use of anonymous class
definitions, a feature which can be
abused very easily.
crx_new(classDefinitionOrClassName, [parameter01, parameter02, ...])
classDefinitionOrClassName
Class Definition or String
The class Definition (object) or name (string)
[parameter01, parameter02, ...]
Mixed
The parameters to be passed to the class constructor.
crx_new(length, classDefinitionOrClassName, [parameter01, parameter02, ...])
The number of instances to create
parameter01, parameter02, ...
Mixed
The parameters to be passed to the class constructor. The parameters are passed
for each construction. Optional.
An array of class instances
crx_new(length, parametersArray, classDefinitionOrClassName)
parametersArray
Array of Arrays
An an array of arrays such as parametersArray[i] is an array of parameters to be passed to the
constructor of instance i; If parametersArray is shorter than the number of instances to create,
the last element is used for the construction of the remaining instances.
Returns an array of class instances
crx_new(length, parametersFunction, classDefinitionOrClassName)
parametersFunction
function
A function that takes a single integer, which is the current index of the instance created, and returns
an array of parameters to be passed to the constructor.
Returns an array of class instances