blob: d7f2448b664e45c6b9cf24ba7a3d0d3b50eab918 (
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
39
|
{ %fail }
{$ifdef fpc}
{$mode delphi}
{$endif}
program InlineClass;
type
TAncestor = class
public
procedure TestMethod; virtual;
end;
TDerived = class(TAncestor)
public
procedure TestMethod; override;
end;
procedure TAncestor.TestMethod; inline; // Virtual method with an 'inline' hint.
begin
WriteLn('Ancestor Method');
end;
procedure TDerived.TestMethod;
begin
WriteLn('Derived Method');
end;
var
TestClass: TAncestor;
begin
TestClass := TDerived.Create;
try
TestClass.TestMethod; // <-- TAncestor.TestMethod is called instead of TDerived.TestMethod
finally
TestClass.Free;
end;
end.
|