Revised by
Stefan Glienke
2d39340
| program Project1;
{$APPTYPE CONSOLE}
type
TFoo = class
private
fCount: Integer;
public
property Count: Integer read fCount;
end;
TFooWithGetter = class
private
fCount: Integer;
function GetCount: Integer;
public
property Count: Integer read GetCount;
end;
TIntegerHelper = record helper for Integer
procedure Inc;
end;
{ TIntegerHelper }
procedure TIntegerHelper.Inc;
begin
System.Inc(Self);
end;
{ TFooWithGetter }
function TFooWithGetter.GetCount: Integer;
begin
Result := fCount;
end;
var
f: TFoo;
f2: TFooWithGetter;
begin
f := TFoo.Create;
f.Count.Inc;
Assert(f.Count = 1);
f2 := TFooWithGetter.Create;
f2.Count.Inc;
Assert(f2.Count = 1);
end.
|