button b; class button{ void delegate() operation; } void set(){ int i = 1; b = new button(); b.operation = {i++;} } void action(){ b.operation(); } void main(){ set(); action(); }