Can a member function return a delegate to itself?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed May 23 06:33:22 PDT 2007


Steve Teale wrote:
> Something like:
> 
> class Foo
> {
>     int a;
> 
>     this() { a = 0; }
> 
>     void delegate(int) sum(int n) 
>               { a += n; return cast(void delegate(int)) &this.sum; }
> }

Yes, although you don't need the cast().

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list