Skip to Content
Former Member
Jun 22, 2005 at 01:31 PM

Using RTTI to identify subclasses


Hello, here is my dilemma:

Class B inherits from Class A. Classes C and D inherit from Class B.

I need to test if object O is an instance of Class A or any of its subclasses (ie Class A, B, C or D). Using the method GET_RELATIVE_NAME is not suitable because then I must know the actual name of the subclass, which I will not. The methods APPLIES_TO and APPLIES_TO_CLASS do not seem to account for inheritance (ie Class D APPLIES_TO Class A is false, even though Class A is a superclass of Class D).

Any feedback would be very nice. I'd like to accomplish this, if possible, using RTTI since it is more elegant than simply casting the object into a reference of type Class A and seeing if an error is thrown.

I'm on 4.7, WebAS 6.30.