Calling an alias for a Class method in another scope

d coder dlang.coder at gmail.com
Fri Jun 1 07:24:12 PDT 2012


Thanks Steve

With your help I am able to make it work.

Thanks and Regards
- Puneet


void callfoo(alias F, T) (T t) {
  void delegate() dg;
  dg.funcptr = &F;
  dg.ptr = cast(void *)t;
  dg();
}

class Foo {
  void foo() {
    import std.stdio;
    writeln("This Works");
  }
}

void main() {
  Foo f = new Foo();
  callfoo!(Foo.foo)(f);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120601/a6d6771e/attachment.html>


More information about the Digitalmars-d mailing list