<div dir="ltr"><div>Hi Ryan,</div><div><br></div><div>It's possible. Just change your declaration of `c`:</div><div><br></div>var c: TBase;<br><div><br></div><div>It still prints TMyClass at the end.</div><div><br></div><div>Of course, you're only going to have access to methods that are declared in TBase.</div><div>You can also approach this sort of thing with interfaces... </div><div><br></div><div>-Michal ( <a href="http://tangentstorm.com/">http://tangentstorm.com/</a> )</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 24, 2020 at 4:08 AM Ryan Joseph via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Free Pascal - General mailing list wrote<br>
> Is it possible to achieve this dynamically without resorting to type<br>
> casting? It feels like classes should have a builtin type for each class,<br>
> like TClassType, which similar to TObject.ClassType but is a compile time<br>
> type.<br>
<br>
I didn't think enough before sending this because this clearly isn't a<br>
compile time issue. Currently this probably isn't possible unless there is<br>
an "AnyClass" type or something like that. Not sure if that exists in Pascal<br>
but methinks not.<br>
<br>
<br>
<br>
-----<br>
Regards, <br>
Ryan Joseph<br>
--<br>
Sent from: <a href="http://free-pascal-general.1045716.n5.nabble.com/" rel="noreferrer" target="_blank">http://free-pascal-general.1045716.n5.nabble.com/</a><br>
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer" target="_blank">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br>
</blockquote></div>