Is using the instanceof keyword against the essence of object oriented programming?
I mean is it a bad programming practice?
I read somewhere that us
There are many good answers promoting virtual methods, but instanceof has its uses as well. Imagine that you iterate over List, to pick up all Urgent objects. You might do it using isUrgent() but I am not sure if it were necessarily more concise or readable. Also, isUrgent() would require making Event aware that its subclasses may possess the respective property, which might:
Event belongs to some library that can not be modified.