Hey. The question is this: I saw the assignment of a reference to a function several times in the object; Suppose I need to make a class TMyAction, in which there are several parameters and a link to the procedure. How to organize this?
[...] type TMyAction = class(TObject) Param1: string; Param2: string; Param3: string; procedure Action; (* тут явно что-то должно быть *) var MyAction1, MyAction2: TMyAction; procedure someFunc; procedure someFunc2; [...] begin [...] MyAction1.Action := @someFunc; MyAction2.Action := @someFunc2; end.
Something like that) That this is possible, I know, I watched. The question is - where in this piece is there something to add?
UPD is ideal such use
if (act = 'go') then with MyAction1 do begin Param1 := var1; Param2 := var2; Action := goProcedure; end;
- access to parameters from procedures.