> On Mar 24, 2020, at 8:39 PM, Michal Wallace via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> Hi Ryan,
> 
> It's possible. Just change your declaration of `c`:
> 
> var c: TBase;
> 
> It still prints TMyClass at the end.
> 
> Of course, you're only going to have access to methods that are declared in 
> TBase.
> You can also approach this sort of thing with interfaces... 
> 

True, but then we're stuck in a typecasting game where I need to cast "c" back 
to TMyClass. :) I probably brought this up years ago and forgot but Objective-C 
has an "id" type which is "can assign to any class type". It seems like 
something that would be standard for OOP but I don't recall ever seeing it in 
Pascal or C++.

Regards,
        Ryan Joseph

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

Reply via email to