Given this example:
Public Class Car
End Class
Public Class Vovlo
Inherits Car
End Class
Public Class BMW
Inherits Car
End Class
When I receive a Car object, how can I determine if the Car object is a Volvo, a BMW or a Car?
I know I can use TypeOf, but when there are several classes that inherits from the Car class, this becomes somewhat cumbersome.
Edit:
This is what I want to acheive:
Public Sub DoSomething()
Dim subClassCar As Car.SubClass = DirectCast(car, Car.SubClass)
End Sub
where Car.CubClass is either a Volvo or BMW if the car object has a subclass, or a car if it do not have a sub class. The problem is how to get the Car.SubClass.