Another option :) from bugtracker by Kazantsev Alexey (
http://bugs.freepascal.org/view.php?id=28820#c89471 ) :

All you need is [s]love[/s] overloaded default properties. As in Delphi.

type

 TObj = Class

   Type

    TValue = Type String;

    TValues = Record

     Function GetEnumerator : TEnumerator;

     Property Items[AIndex : Integer] : TValue Read GetValueByIndex Write
SetValueByIndex; Default;
     Property Items[Const AName : String] : TValue Read GetValueByName
Write SetValueByName; Default;

    End;

   Property Values : TValues Read GetValues;

 End;

var v : TObj.TValue;
    obj : TObj;

begin

  obj.Values[1] := '1';
  obj.Values['2'] := '2';

  for v in Obj.Values do;

end.
-- 
Best regards,
Maciej Izak
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to