language: D (dmd) (dmd-2.042)
date: 460 days 14 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import std.stdio;
 
class Foo
{
    int b = 5;
    auto bar(int a)
    {
        return delegate() { return a + b; };
    }
}
 
void main(string[] args)
{
    auto f = new Foo;
    auto dg = f.bar(5);
 
    writeln (dg() == 10);
 
    f.b = 10;
    writeln (dg() == 15);
}