A Delegate Allows Assigning a Non-Static Nested Function to a Variable
Part of DelegateCategory
Description
A delegate allows assigning a non-static nested function to a variable.
Example
int delegate() dg; void main() { int a = 7; int foo() { return a + 3; } dg = &foo; int i = dg(); /* i is set to 10 */ }
Source
From http://www.digitalmars.com/d/function.html#closures
| Link | http://www.dsource.org/tutorials/index.php?show_example=60 |
| Posted by | jcc7 |
| Date/Time | Wed Aug 11, 2004 6:55 pm |
