skalogryz: and yes and no. I need to code that you post to work(is this already can achieved, can you give link to full example?).You can achieve something like this using class helpers.
P/s: offtopic, but I'm don't understand why when I write Quick reply(or Reply) syntax highlighter highlight words 'neighbour' and 'behaviour'? Every time I doubt that I write it correct and verify in google translator - it's a bit bother.neighbour vs neighbor (http://grammarist.com/spelling/neighbor-neighbour/)
type cTestClass = class
function GetValue (Idx : integer) : string; virtual; abstract; overload;
function GetValue (Key : string) : string; virtual; abstract; overload;
property Value [Idx : integer] : string read GetValue;
property Value [Key : string] : string read GetValue;
end;
ady compiling and working. The only difference between Delphi and FPC/Lazarus was: In Delphi (i used 2007), this works ONLY for default properties. In FPC 2.6.4, only one of those properties could be declared as default (but it also works for non-default).
type cTestClass = class
function GetValue (Idx : integer) : string; overload; virtual; abstract;
function GetValue (Key : string) : string; overload; virtual; abstract;
property Value [Idx : integer] : string read GetValue; {$IFNDEF FPC }default;{$ENDIF}
property Value [Key : string] : string read GetValue; {$IFNDEF FPC }default;{$ENDIF}
end;
Ok, in Delphi 10.1 (this is the only newer version that i have), you have to reorder the keywords like this:
FPC supports overloaded properties - but it's a bug in FPC.if you call it 'bug' , not 'future', so is in plan to fix it? If so, I don't understand SnoopyDog's joy, because code will not work in future.
in the end of the day i do not understands if this "feature" (allowing properies to use differnt type of indices ) is future safe or is just a bug in the compiler...
help apreciated because my code relies on this
thanks!