[fpc-pascal] parent class as a parameter type

Sven Barth pascaldragon at googlemail.com
Sun Nov 13 14:40:42 CET 2011


On 12.11.2011 22:18, ik wrote:
> Since 2.6.0, when you write something like this:
>
> procedure foo(AClass : TStrings);
> foo(MyStringList); // Will return an error that TStrings is expected ...
>
> I can not use TStringList as the parameter without casting it to TStrings.
> But I do not understand why this limitation added. Can you please
> explain it to me ?

It works here with 2.6.0 RC1.

Can it be that you used "var" or "out"? Cause than this is expected: 
http://wiki.freepascal.org/User_Changes_2.6.0#Passing_derived_classes_to_var-_and_out-parameters

Regards,
Sven



More information about the fpc-pascal mailing list