Created
January 15, 2011 21:52
-
-
Save seanparsons/781306 to your computer and use it in GitHub Desktop.
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
abstract class SpecialWeapon | |
case class SpecialWeaponUsed(val player: String, val weapon: SpecialWeapon) | |
case class NuclearBomb(val megatons: Int) extends SpecialWeapon | |
val result = new SpecialWeaponUsed("Sean", new NuclearBomb(17)) match { | |
case SpecialWeaponUsed(name, NuclearBomb(megatons)) => name + " used a " + megatons + " megaton nuclear bomb." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment