[fpc-devel] suggestion: virtual method co-variance
Thaddy de Koning
thaddy at thaddy.com
Wed Oct 15 17:30:10 CEST 2014
Isn't that exactly what is done in C++?
It is prepared in library code.
On 10/14/2014 12:40 PM, Marco van de Voort wrote:
> I recently had to dive a bit into C++ again, and reconnected with a feature
> I liked at first sight, the C++ covariance of virtual methods (changing the
> return type of a overriden method to a descendant of the original type).
> Googling a bit it seems that some languages(C#) also seem to allow this for
> parameters. (not just return types)
>
> I suddenly wondered why it was never proposed or talked about for FPC,
> since it seems such a nice feature. Is there something particularly wrong
> with it?
>
> To a certain degree it can be emulated with generics, but that it
> requires a generic for every type, and must be prepared in the library code.
>
>
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
More information about the fpc-devel
mailing list