I have this situation:
type TWheel = record private type TWheelEnum = (whBA, whCA, whFI, whGE, whMI, whNA, whPA, whRM, whRN, whTO, whVE); var FWheelEnum: TWheelEnum; public class operator Implicit(const Value: string): TWheel; class operator Implicit(const Value: TWheel): string; end;
with:
var awheel, bwheel: twheel; begin try awheel := 'PA'; bwheel := 'PA'; if awheel = bwheel then writeln ('pippo'); end.
When I started it, turn me this error:
E2015 Operator not applicable to this operand type
I decided to write:
if awheel = string(bwheel) then writeln ('pippo');
but can you solve it without adding a line (...)? At the first moment, I came up with something like:
class operator Implicit(const Value: TWheel): Twheel;
but the compiler will give me an error saying that only one type of TWheel is accepted. So I wanted to know if there is a solution for it, or do I need a conversion type with a string (...)? Thank you very much.
source share