I am using the operator overloading for records in Delphi 2006. (Please don\'t answer this question by telling me not to.)
I have two record types with the impli
You can't have forward declarations for record types. Define both Implicit operators in the second type:
type
TMyRec1 = record
Field1 : Integer;
end;
TMyRec2 = record
Field2: Integer;
class operator Implicit(a: TMyRec2): TMyRec1;
class operator Implicit(a: TMyRec1): TMyRec2;
end;
Quoting from the help:
Implicit conversions should be provided only where absolutely necessary, and reflexivity should be avoided. It is best to let type B implicitly convert itself to type A, and let type A have no knowledge of type B (or vice versa).