Sven Barth schrieb:
On 28.10.2014 09:57, Hans-Peter Diettrich wrote:

 > Something like ShortString and AnsiString?

Take unit Typinfo for example where quite some methods take a TObject
instance.

The TypInfo methods can determine the exact type of their arguments, and
act inside accordingly.

If you have a method X that takes a TObject parameter how do you plan to pass it a reference counted object when these and TObject are not compatible *at compiletime*?

That's intentionally impossible in general. For TypInfo, a dedicated method (override) can be added, or an untyped parameter can be used like in FreeAndNil.

DoDi

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to