I have a class that has a bunch of subclasses that inherit it. How can I check if an object is an instance of this superclass, and not any of the derived classes?
Example:
I have a Vehicle class, and it has several classes that inherit from it, such as car, motorcycle, bicycle, truck, etc.
Assuming this, how can I check if a vehicle’s object really belongs to the Vehicle class, and not to a car or bicycle? (Since in this case, a car and a bicycle are an example of the Vehicle class).
source
share