Language documentation Contents | Index

The delegates, Data types


Description:
Delegates are functions contained by an object (by object you should understand an instantiated class) that are referenced by a variable. Delegates cannot be static functions. A delegate should respect the rights of the calling point (so, if is private, the caller must be able to call the delegate). Delegates can be passed as parameters to functions providing callback.

Example:
class Main {

function mydelegate(x) {
echo x; // prints x
}

function Main() {
var f=mydelegate;
// now e can call the delegate function this way:
f();
}
}



Documented by Eduard Suica, generation time: Thu Oct 15 20:02:09 2009 GMT(c)2009 RadGs Software