Debug help - delegate from dlang Tour
Brother Bill
brotherbill at mail.com
Mon Sep 8 16:28:47 UTC 2025
This works:
```
import std.stdio;
void main()
{
foo();
}
void foo() {
int addMyInts(int lhs, int rhs) {
return lhs + rhs;
}
int doSomething(int delegate(int, int) doer)
{
// call passed function
return doer(5, 6);
}
doSomething(&addMyInts);
}
```
Is there another way to have this work other than making
addMyInts static?
```
int doSomething(int function(int, int) doer)
{
// call passed function
return doer(5, 6);
}
```
More information about the Digitalmars-d-learn
mailing list