Explicitly passing `this` to methods
Tobias Pankrath via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 19 05:27:04 PDT 2014
On Thursday, 19 June 2014 at 12:00:01 UTC, Tomer Filiba wrote:
> That requires me having the names in scope, etc. I want to be
> able to use the function object, just like I could do if it
> weren't a method.
>
>
> -tomer
>
class C
{
void methodOfC(int x) { writeln(x); };
}
void main()
{
auto c = new C;
auto method = &(c.methodOfC);
method(12);
}
There are no method function pointer in D, but delegates work.
More information about the Digitalmars-d
mailing list