Re: [fpc-pascal] Generic with inheritance - fpc 3.0
On Mon, 30 Nov 2015, Sven Barth wrote: Am 30.11.2015 15:55 schrieb "Torsten Bonde Christiansen" : Hi. The docs for 3.0 does not directly mention generics and inheriting from another generic class, but I tried out with the code below. It compiled, ran and worked fine but since the docs do not explicit mention it as a posibility I am a little reluctant to go forward using this strategy if is not meant to work... Yes, that's supposed to work :) I will add this to the documentation. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Generic with inheritance - fpc 3.0
Am 30.11.2015 15:55 schrieb "Torsten Bonde Christiansen" : > > Hi. > > The docs for 3.0 does not directly mention generics and inheriting from another generic class, but I tried out with the code below. > It compiled, ran and worked fine but since the docs do not explicit mention it as a posibility I am a little reluctant to go forward using this strategy if is not meant to work... Yes, that's supposed to work :) Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Generic with inheritance - fpc 3.0
Hi. The docs for 3.0 does not directly mention generics and inheriting from another generic class, but I tried out with the code below. It compiled, ran and worked fine but since the docs do not explicit mention it as a posibility I am a little reluctant to go forward using this strategy if is not meant to work... (ps. i know this is incomplete code, but it should illustrate my point)type type { TMyType } generic TMyType = class private Item: T; public constructor Create; virtual; end; { TMyDerivedType } generic TMyDerivedType = class(specialize TMyType) private Count: Integer; public constructor Create; override; end; TMyIntClass = specialize TMyDerivedType; [...snipped both Create implementations...] var IC: TMyIntClass; begin M := TMyIntClass.Create(); M.Item := 20; M.Count := 2; M.Free; end; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal