mrrrk,
I normally use the TypeOf operator for this.
Dim thing as thingBase
If TypeOf thing Is thingBase1 Then
Dim thing1 As thingBase1 = DirectCast(thing, thingBase1)
ElseIf TypeOf thing Is thingBase2 Then
Dim thing2 As thingBase2 = DirectCast(thing, thingBase2)
End If
However this should be the exception and not the norm!!!!
If you have code that behaves differently based on thingBase1 or thingBase2,
you should consider making that code an overridable method of thingBase and
have thingBase1 & thingBase2 override the method with their own code! Which
is Polymorphism & one of the reasons for inheritance.
Hope this helps
Jay
"mrrrk" <no***@xxx.yyy> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl...
Supposing I have a base (abstract) class called thingBase and then I
create two more abstract classes from it, e.g. thingBase1, thingBase2.
I have code that operates on thingBase objects but I need to know whether
the object is inherited from thingBase1 or thingBase2.
How do I tell which base class was used?