4.5 Delegate

Delegates are objects that can substitute for other objects during property name lookup. Every object has a delegate, which is either of the same type as that object or of type Object. An instance of a class is an example of an object that has a delegate of the same type. Class instances all share the same delegate--the defining class's prototype object. A class's prototype object is a special instance of that class that provides a mechanism for sharing state across all instances of a class.

At runtime, when a property is not found on a class instance, the delegate, which is the class prototype object, is checked for that property. If the prototype object does not contain the property, the process continues with the prototype object's delegate. A prototype object is an example of an object that has a delegate of type Object. All class prototype objects share the same delegate--a special static property of the Object class named Object.prototype.


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification30.html