Delegates can be seen as "method pointers". They contain a reference to the object and a pointer to the method, therefore it can not point to functions or static methods.
Example:
int delegate(int) foobar;
class Foo {
int mymethod(int x) {
return x;
}
}
Foo foo = new Foo();
foobar = &foo.mymethod;
writefln(foobar(128));
|
|