[fpc-pascal]Any way to find out ancestry of object? (at runtime)
Jonas Maebe
jonas at zeus.rug.ac.be
Wed Jun 20 15:17:54 CEST 2001
On woensdag, juni 20, 2001, at 03:05 , Marcel van der Heide wrote:
> I would like to find out at runtime if an object is a descendant of a
> certain
> object. Is there any way to do this? The TypeOf function can be used to
> find
> out if an object _is_ of a certain type but not if an object is a
> descendant
> of an object.
This is only available for classes (using the inheritsfrom() method),
not for objects.
PS: don't use typeof() on classes, it returns bogus results there. Use
the "is" operator instead for classes. The compiler still needs to be
fixed so it rejects typeof() applied to classes, since it only works on
TP-style objects.
Jonas
More information about the fpc-pascal
mailing list