Defining methods
Explains how methods are defined in IBM ILOG Script.
Since a method is really a property which contains a function value, defining a method simply consists in defining a regular function, then assigning it to a property.
For example, the following program adds a method start to
the myCar object defined in the previous
section:
function start_engine() {
writeln("vroom vroom")
}
myCar.start = start_engine
Now, the expression myCar.start() will
call the function defined as start_engine.
Note that the only reason for using a different name for the function
and for the method is to avoid confusion; we could have written:
function start() {
writeln("vroom vroom")
}
myCar.start = start