I'm trying to do something like this:

------------
module mylib.classA;

class A
{
  @property string myproperty;
  void function(ref A a) callToMyFunction;

  void myfunction()
  {
    callToMyFunction(ref this);
  }
}

------------
module myapp;

import mylib.classA;

int main()
{
  A a = new A();

  a.callToMyFunction = &myFunction;

  a.myfunction();
}

void myFunction(ref A a)
{
  writefln(a.myproperty);
}

------------

but (clearly) cannot compile. How can I get the same result?

Thank you in advance.

Reply via email to