-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuperson.pas
55 lines (41 loc) · 1001 Bytes
/
uperson.pas
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
51
52
53
54
55
unit uPerson;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils;
type
{ TPerson }
TPerson = class
private
FAge: integer;
FName_: string;
procedure SetAge(AValue: integer);
procedure SetName_(AValue: string);
public
constructor Create(AName: string; AAge: integer);
property Name_: string read FName_ write SetName_;
property Age: integer read FAge write SetAge;
end;
function ComparePerson(const Item1, Item2: TPerson): Integer;
implementation
{ TPerson }
function ComparePerson(const Item1, Item2: TPerson): Integer;
begin
Result := AnsiCompareStr(Item1.Name_,Item2.Name_);
end;
procedure TPerson.SetAge(AValue: integer);
begin
if FAge=AValue then Exit;
FAge:=AValue;
end;
procedure TPerson.SetName_(AValue: string);
begin
if FName_=AValue then Exit;
FName_:=AValue;
end;
constructor TPerson.Create(AName: string; AAge: integer);
begin
FName_:= AName;
FAge:=AAge;
end;
end.