const Propagation

Julian Kranz via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 29 07:51:51 PST 2014


Sorry, copy+paste error, I of course meant the following :-/...

import std.stdio;

class Hugo {
   public int x = 42;

   void blah(void function(const Hugo h) f) {
     f(this);
   }
}

void main() {
     Hugo hugo = new Hugo();

     const Hugo inge = hugo;
     void function(const Hugo h) g = function(const Hugo h) {
       write("foobar ");
       writeln(h.x);
     };
     inge.blah(g);
}


More information about the Digitalmars-d mailing list