[fpc-pascal] parent class as a parameter type

ik idokan at gmail.com
Thu Nov 17 15:07:06 CET 2011


On Thu, Nov 17, 2011 at 16:03, Sven Barth <pascaldragon at googlemail.com>wrote:

> Am 17.11.2011 09:23, schrieb ik:
>
>     It's not allowed in Delphi in case of a var/out parameter. It's
>>    allowed in both FPC and Delphi in case of a value/const parameter.
>>
>>
>> Sorry for the late response, but why does out and var limit this issue ?
>> I understand that it does, but not the reason for it.
>>
>
> The reason is mentioned in the link I sent you:
> http://wiki.freepascal.org/**User_Changes_2.6.0#Passing_**
> derived_classes_to_var-_and_**out-parameters<http://wiki.freepascal.org/User_Changes_2.6.0#Passing_derived_classes_to_var-_and_out-parameters>
>

I read it, but I do not understand it.

TStrings is a class. TStringList is a class inherited from TStrings. How
does it prevent the type checking ?
As I remember, if I placed there "TFom" based class, it will not like it
and report and error. That's why I do not understand it I guess.


>
> Regards,
> Sven
>
> ______________________________**_________________
>
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111117/8f39ccb8/attachment.html>


More information about the fpc-pascal mailing list