blob: b85177dd0606eae2928ca816944dfef743ca3160 (
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
40
41
42
43
44
45
46
47
48
49
50
|
{ %fail }
{$ifdef fpc}{$mode objfpc}{$H+}{$endif}
type
TPoint = record
X,Y : integer;
end;
{ TSomeUselessObject }
TSomeUselessObject = class(TObject)
fSomeProperty: TPoint;
private
function GetSomeProperty: TPoint;
procedure SetSomeProperty(AValue: TPoint);
public
constructor Create;
property SomeProperty: TPoint read GetSomeProperty write SetSomeProperty;
end;
{ TSomeUselessObject }
procedure TSomeUselessObject.SetSomeProperty(AValue: TPoint);
begin
fSomeProperty := AValue;
end;
function TSomeUselessObject.GetSomeProperty: TPoint;
begin
Result := fSomeProperty;
end;
constructor TSomeUselessObject.Create;
begin
fSomeProperty.X := 50;
fSomeProperty.Y := 100;
end;
var SomeUselessObject: TSomeUselessObject;
begin
SomeUselessObject := TSomeUselessObject.Create;
WriteLn('By Default X = ', SomeUselessObject.SomeProperty.X, ' and Y = ',
SomeUselessObject.fSomeProperty.Y);
SomeUselessObject.SomeProperty.X := 200;
SomeUselessObject.SomeProperty.Y := 500;
WriteLn('Now X = ', SomeUselessObject.SomeProperty.X, ' and Y = ',
SomeUselessObject.fSomeProperty.Y);
end.
|