Skip to content

Instantly share code, notes, and snippets.

@smsohan
Created November 2, 2011 01:46
Show Gist options
  • Save smsohan/1332622 to your computer and use it in GitHub Desktop.
Save smsohan/1332622 to your computer and use it in GitHub Desktop.
Example of poor use of the instanceof operator
public void processMessage(Object message){
if(message instanceof CleanFloor){
((CleanFloor) message).cleanKitchen();
}
elsif(message instanceof LaunchRocket){
((LaunchRocket) message).shootToMoon();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment