Ryan Joseph <generic...@gmail.com> schrieb am Mo., 10. Juni 2019, 21:31:
> > > > On Jun 10, 2019, at 3:25 PM, Ben Grasset <operato...@gmail.com> wrote: > > > > Result in your example is the size of a pointer in all cases, which is > fine / exactly what you'd expect it to be. > > > > Sorry, if I dereference the size is still of TBase. I don’t think “result" > is actually changing depending on the class type. This may have something > to do with the way new works though. How can we fix this? > Of course the dereferentiation of PBase while always have the size of TBase. That's the point of a pointer. You need to add a static Create method to each subclass if you want to use that concept. And no kind of TClassSelf or whatever will help you there as you'd need virtual class functions for that and objects don't support those just as they don't support a "class of" kind of type. There's a reason why classes are superior in nearly all cases after all. Regards, Sven >
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel