mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 21:49:43 +02:00

with the VMT of the instance as self instead of the self instance pointer (mantis #29491) git-svn-id: trunk@34395 -
29 lines
452 B
ObjectPascal
29 lines
452 B
ObjectPascal
program test;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
type
|
|
TCallback = procedure of object;
|
|
|
|
TTestObject = class (TObject)
|
|
public
|
|
class procedure Test;
|
|
end;
|
|
|
|
class procedure TTestObject.Test;
|
|
begin
|
|
writeln(Self.ClassName); // Self should point to TTestObject (class)
|
|
if Self.ClassName<>'TTestObject' then
|
|
halt(1);
|
|
end;
|
|
|
|
var
|
|
Callback: TCallback;
|
|
O: TTestObject;
|
|
begin
|
|
O := TTestObject.Create;
|
|
Callback := @O.Test;
|
|
Callback();
|
|
O.Free;
|
|
end.
|