Introduction to Delegate parts

A Delegate part provides a model for a function.

A Delegate part is similar to a function pointer in COBOL or C. When you declare a variable, you specify the Delegate part name as a type, just as you specify a Record part name when you declare a record variable. The variable is initialized, or assigned the name of a matching function with the same signature (parameter and return type definition) as the Delegate part. You can specify a delegate variable in the place of the function name on a function invocation. Then you can choose the actual function to be called dynamically.

The most common use for Delegate parts is as an infrastructure to register event handlers. For more information, see ExternalType for Java code. Nothing in EGL generates events, though some associated UI technologies do. Still, the event-driven architecture is an increasingly common model for programming, and you can use Delegate parts in situations that do not involve user interfaces, including the following:

The Delegate part does not have properties. For more information about the Delegate part, see Delegate part.


Feedback