TYAMLNode Question
Why/How does this assignment work?
var MyYAMLNode: TYAMLNode; //Line 1 var iValue: integer = MyYAMLNode; //Line 2 var sValue: string = MyYAMLNode; //Line 3
With records that I declare line 2 would give me a "Incompatible types "Integer" and "TMyRecord" With records that I declare line 3 would give me a "Incompatible types "String" and "TMyRecord"
This is because TYamlNode has various overloaded implicit operators. For example:
type
TYamlNode = record
...
class operator Implicit(const ANode: TYamlNode): Int32; inline; static;
end;
This operator implicitly converts a TYamlNode to an integer. See Operator Overloading (Delphi) for more information about operator overloading.
Thank you very much Eric. That life - long mystery is now solved for me. Have a great day.