blob: e742247db520551d81e12cf4231cae1e8950872c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
{$mode delphi}
type
TProc = procedure of object;
TTest = class
public
proc: TProc;
constructor Create;
procedure foo;
procedure bar;
end;
constructor TTest.Create;
begin
inherited;
proc := nil;
end;
procedure TTest.foo;
begin
writeln('foo');
end;
procedure TTest.bar;
begin
if @proc <> nil then proc;
end;
var
t: TTest;
begin
t := TTest.Create;
t.proc := t.foo;
t.bar;
t.Free;
end.
|