[fpc-pascal] overloaded property index

Sven Barth pascaldragon at googlemail.com
Fri Aug 12 17:13:00 CEST 2016

Am 12.08.2016 16:52 schrieb "Luca Olivetti" <luca at ventoso.org>:
> I'm still using fpc 2.6.4 (but I tested what I'm saying below with fpc
3.0.0 too).
> I need to overload the type of the index of an indexed property, e.g.
> function GetMyProp(index:integer):TMyPropType;
> function GetMyProp(index:TMyType):TMyPropType;
> ....
> property MyProp[index:integer]:TMyPropType read GetMyProp;
> property MyProp[index:TMyType]:TMyPropType read GetMyProp;
> this gives a "Duplicate identifier" error.
> I found previous discussions about this error and
> *but* if I omit the second property declaration, the code compiles fine
and I can use MyProp indexed either by an integer or by TMyType.
> Is this by design or is it just an accident?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160812/702d751a/attachment.html>

More information about the fpc-pascal mailing list