[fpc-pascal] Chaining method calls
michal.wallace at gmail.com
Tue Mar 24 14:39:05 CET 2020
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
You can also approach this sort of thing with interfaces...
-Michal ( http://tangentstorm.com/ )
On Tue, Mar 24, 2020 at 4:08 AM Ryan Joseph via fpc-pascal <
fpc-pascal at lists.freepascal.org> wrote:
> Free Pascal - General mailing list wrote
> > Is it possible to achieve this dynamically without resorting to type
> > casting? It feels like classes should have a builtin type for each class,
> > like TClassType, which similar to TObject.ClassType but is a compile time
> > type.
> I didn't think enough before sending this because this clearly isn't a
> compile time issue. Currently this probably isn't possible unless there is
> an "AnyClass" type or something like that. Not sure if that exists in
> but methinks not.
> Ryan Joseph
> Sent from: http://free-pascal-general.1045716.n5.nabble.com/
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal