[fpc-pascal]Any way to find out ancestry of object? (at runtime)

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Jun 20 15:24:53 CEST 2001

On Wed, 20 Jun 2001, 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.
> If there is no way to do this (easily), maybe it would be a good idea to add
> such a function?

For classes you can use the 'is' function:

If TSomeClass is  TSomeOtherClass then

I am not sure whether it is possible for objects also.


More information about the fpc-pascal mailing list