Find out if Delphi ClassType inherits from other ClassType?

In Delphi, given the following:

TFruit = class;
TFruitClass = class of TFruit;

TApple = class(TFruit);

TRedApple = class(TApple);

If I have a TFruitClass variable, how can I find out if it inherits from TApple? E.g. say I have

var
  FruitClass: TFruitClass;
...
FruitClass := TRedApple;

How can I verify that FruitClass does indeed inherit from TApple in this case? Using FruitClass is TApple only works for class instances.

5
задан David 14 December 2010 в 19:30
поделиться