Ryan Joseph via fpc-pascal <fpc-pascal@lists.freepascal.org> schrieb am
Mo., 2. Dez. 2019, 14:01:

>
>
> > On Nov 30, 2019, at 12:58 PM, Sven Barth via fpc-pascal <
> fpc-pascal@lists.freepascal.org> wrote:
> >
> > This can't work. ClassType is of type TClass and TClass.Create calls
> TObject.Create, *not* the constructor of your list type, cause the
> constructor chain is not virtual.
>
> Ok, so if the constructor was virtual this would work as expected? I guess
> that make sense.
>

In this specific case: not really. Because TFPSList has a different
constructor signature than TFPGList<>. And even then you'd need to cast
ClassType to a "class of TFPSList" type as TObject.Create is never virtual.

Regards,
Sven

>
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to