On Thu, 28 Jan 2016 22:33:39 +0400, Ondrej Pokorny <[email protected]>
wrote:
why the double-posting?
Because my example answer to your querys:
First, I don't want to publish the TEnumeratedObjects object to the
outside of TTest (e.g. you could call Free on it and do other stuff I
don't want to be allowed).
You can return record, and what is more, record of nested private type
(i.e. user can use your type, but can't declare variable of your type).
Second, TEnumeratedObjects doesn't even need to exist! What about
"virtual" array properties that are not mapped to existing objects?
It because your example very simple. In more complex cases we can have
other methods/overloaded operators in returned record. And it more
flexible solution.
TValueArray = Array Of TObj.TValue;
var va : TValueArray;
Obj.Values.Sort;
va := Obj.Values;
--
Kazantsev Alexey
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel