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: Fri Jan 21 18:06:24 2011 GMT(c)2011 RadGs Software