[fpc-pascal] parent class as a parameter type

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Nov 14 02:11:20 CET 2011


On 12 Nov 2011, at 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 ...

Are you certain there is no "var" or "out" in front of that parameter?

> 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 ?

In case of a var/out parameters: http://wiki.freepascal.org/User_Changes_2.6.0#Passing_derived_classes_to_var-_and_out-parameters

That page is also linked from the announcement mail and the readme.


Jonas


More information about the fpc-pascal mailing list