Created
November 11, 2010 21:40
-
-
Save tcoupland/673248 to your computer and use it in GitHub Desktop.
WhoNeedsVisitor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SpaceShip ship = new BigSpaceShip(); | |
LauncherSystem launcher = new LauncherSystem(); | |
launcher.launch(ship); | |
class LauncherSystem{ | |
public void launch(SpaceShip ship){ | |
Launcher launcher = new Launcher(); | |
launcher.launch(ship); | |
} | |
} | |
class Launcher{ | |
public void launch(SpaceShip ship){ | |
System.out.println("Got a SpaceShip"); | |
} | |
public void launch(BigSpaceShip ship){ | |
System.out.println("Got a BigSpaceShip"); | |
} | |
} | |
class BigSpaceShip extends SpaceShip{ | |
} | |
class SpaceShip{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment