I know how to get enum value from integer value, and I have this code
function GetEnumValue(intValue:integer):TMyType
begin
if(ordValue >= Ord(Low(TMyType)))and(ordValue <= Ord(High(TMyType)))then
result :=TMyType(ordValue)
else
raise Exception.Create('ordValue out of TMyType range');
end;
I have similiar code like above in many place for many enum type other than TMyType, I want encapsulate that code to single protected code on base class, so inherited class can use it.
but I dont know how to generalize TMyType, so my code can check if it right enum type or another type object
I cant have a clue what a enum base class (like TObject for all of object type or TControl for all of VCL type), then I can check like that code