I'm adding some functions for TPoint
and if I use the same name as the global function, I can't see it inside helper function. Am I missing something or I can't simply do that?
uses
Winapi.Windows, Math;
type
TPointHelper = record helper for TPoint
function InRange(const AMin, AMax: TPoint): Boolean;
end;
implementation
function TPointHelper.InRange(const AMin, AMax: TPoint): Boolean;
begin
Result := InRange(X, AMin.X, AMax.X) and InRange(Y, AMin.Y, AMax.Y);
end;
end.
You need to fully qualify the call to InRange
because the compiler sees the InRange
in the closest scope. Which is your helper method. Your code should read:
function TPointHelper.InRange(const AMin, AMax: TPoint): Boolean;
begin
Result := Math.InRange(X, AMin.X, AMax.X) and Math.InRange(Y, AMin.Y, AMax.Y);
end;