About the author
In Delphi 2009, Embarcadero added the anonymous method to the Delphi language.
How is it implemented?
Internally, it is implemented as an interface which implements a single method, Invoke.
So if you have IX declared as reference to procedure, then IX is technically equivalent to the following:
IX =
interface
procedure
Invoke;
end
;
And if you have IX declared as reference to function: Integer, you would have IX being technically equivalent to:
function
Invoke:
Integer
With IX being declared as reference to procedure, let's declare a class, TX:
TX =
class
(TInterfacedObject, IX)
public
TX
.
begin
WriteLn
(
'Hello World'
);
var
LX: TX;
AX: IX;
LX := TX
Create;
AX := LX;
AX;