mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 04:49:26 +02:00
32 lines
491 B
ObjectPascal
32 lines
491 B
ObjectPascal
{ %FAIL }
|
|
program TestDefaultProperty;
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
uses
|
|
SysUtils;
|
|
|
|
type
|
|
TMyClass = class
|
|
private
|
|
function GetItems(Index: integer): integer;
|
|
public
|
|
property Items[Index: integer]: integer read GetItems; default;
|
|
end;
|
|
|
|
function TMyClass.GetItems(Index: integer): integer;
|
|
begin
|
|
writeln('Get Index=',Index);
|
|
Result:=Index;
|
|
end;
|
|
|
|
var MyClass: TMyClass;
|
|
i: integer;
|
|
|
|
begin
|
|
MyClass:=TMyClass.Create;
|
|
i:=MyClass.Items;
|
|
writeln('i=',i);
|
|
MyClass.Free;
|
|
end.
|