delphi - Array of procedures inside a class pointing to class method -
i have class (texample) , want have array of pointers point texample methods. example, i'd have texample.thinkone , apointers[1] := @texample.thinkone or similar. how can this? thanks.
you can this:
type tproctype = procedure(const aparm: integer) of object; // method type tprocarray = array of tproctype; // dynamic array texample = class public procedure a(const aparm: integer); // method signature matches tproctype procedure b(const aparm: integer); end; var pa : tprocarray; procedure init(const aexample: texample); begin setlength(pa, 2); pa[0] := aexample.a; pa[1] := aexample.b; end;
Comments
Post a Comment