|
Programming with Castalia : Refactoring : Add Parameter
|
Previous Top Next |
|
|
| function CalculateAge(Birthday: TDateTime): Integer;
|
| var
|
| I: Integer;
|
| begin
|
| I := Trunc(Now - Birthday);
|
| if I < 18 then
|
| raise EUnderageCustomer.CreateFmt('Customer is only %d', [I]);
|
| Result := I;
|
| end;
|
|
|
|
| function CalculateAge(Birthday: TDateTime; CalculateDay: TDateTime): Integer;
|
| var
|
| I: Integer;
|
| begin
|
| I := Trunc(Now - Birthday);
|
| if I < 18 then
|
| raise EUnderageCustomer.CreateFmt('Customer is only %d', [I]);
|
| Result := I;
|
| end;
|
|
|