A comparison between C++ and D

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 9 18:20:46 PST 2016


On Thursday, 10 March 2016 at 00:31:00 UTC, John Colvin wrote:
> what magic is this? I had no idea that taking the address of 
> opCall would give me a delegate.

opCall is a red herring: taking the address of *any* non-static 
member function in a class or struct object will give you a 
delegate.

(Addresses of static member function will give you a function 
pointer, and so will taking the address of ClassName.memberName. 
But classObject.memberName is a delegate because there is a this 
pointer attached.)


More information about the Digitalmars-d mailing list