I'm trying to write an helper class function without statically referencing to the helped class:
TMyEnum = (meA, meB, meC);
TMyEnumHelper = record helper for TMyEnum
public
class function InRange(AValue : integer) : Boolean; static;
end;
...
class function TMyEnumHelper.InRange(AValue : Integer) : Boolean;
begin
Result := (
(AValue >= Ord(Low(TMyEnum))) and
(AValue <= Ord(High(TMyEnum)))
);
end;
Is there a way to dynamically get the helped class? I mean something like the following code:
class function TMyEnumHelper.InRange(AValue : Integer) : Boolean;
begin
Result := (
(AValue >= Ord(Low(HelpedClass))) and
(AValue <= Ord(High(HelpedClass)))
);
end;
I've tried using Self
but Delphi says E2003 Undeclared identifier: 'Self'