interface
type
TPerson = class(TObject)
private //私有域
FName: string;
FAge: Integer;
procedure SetName(const strName: string);
procedure SetAge(const intAge: Integer);
public //公有域
property Name: string read FName write SetName;
property Age: Integer read FAge write SetAge;
end;
TPerson = class(TObject)
private //私有域
FName: string;
FAge: Integer;
procedure SetName(const strName: string);
procedure SetAge(const intAge: Integer);
public //公有域
property Name: string read FName write SetName;
property Age: Integer read FAge write SetAge;
end;
implementation
{ TPerson }
procedure TPerson.SetName(const strName: string);
begin
FName := strName;
end;
begin
FName := strName;
end;
procedure TPerson.SetAge(const intAge: Integer);
begin
if intAge < 0 then FAge := 0 else FAge := intAge;
end;
begin
if intAge < 0 then FAge := 0 else FAge := intAge;
end;