Function Pointer field



Function Pointer field
Smart pascal source code
Type TProc = Procedure; procedure Hello; begin WriteLn('Hello'); end; var P: TProc := Hello; P; // normal call Type TObj = Class FProc: TProc; Procedure Proc; Begin FProc; // error. FProc() - normal End; End; var o := TObj.Create; o.FProc := Hello; o.Proc; {<<< RESULT - CONSOLE LOG >>> ----------------------------- Hello Hello ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}