<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ryan Joseph <<a href="mailto:genericptr@gmail.com">genericptr@gmail.com</a>> schrieb am Mo., 10. Juni 2019, 21:31:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On Jun 10, 2019, at 3:25 PM, Ben Grasset <<a href="mailto:operator97@gmail.com" target="_blank" rel="noreferrer">operator97@gmail.com</a>> wrote:<br>
> <br>
> Result in your example is the size of a pointer in all cases, which is fine / exactly what you'd expect it to be.<br>
> <br>
<br>
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? <br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>