[ create a new paste ] login | about

Link: http://codepad.org/8nnoIKNQ    [ raw code | output | fork ]

BCSd - D, pasted on Jun 9:
import std.stdio;
struct S
{
    int go()
    {
        U u;
        u.s = this;
        return u.a + u.b;
    }
}

union U
{
    S* s;
    struct
    {
         short a;
         short b;
    }
}

void main()
{
     U u;
     u.a= 54;
     u.b = 42;

     int delegate() dg = &u.s.go;


     writef("%s\n", dg()); 
}


Output:
1
96


Create a new paste based on this one


Comments: