CrossTalk Archive

Overloaded Indexed Properties

Overloaded Indexed Properties

Delphi cannot overload indexed properties. So CrossTalk adds suffixes to the overloads.

In System.Xml.XmlReader the Items property is declared as: public virtual string this[string name]
public virtual string this[int i]
public virtual string this[string name, string namespaceURI]

This declares it to be the default indexer as well. Internally it declares its as “Item” and that is how CrossTalk will translate it. However the second problem is that it uses overloading, which Delphi does not support on indexed properties. Because of this, CrossTalk will add a numeric suffix starting with the second occurrence.

property Item[const ai: Integer]: string read ItemRead;
property Item1[const aname: string]: string read Item1Read;
property Item2[const aname: string; const anamespaceURI: string]: string read Item2Read;