Skip to content

Instantly share code, notes, and snippets.

@seanparsons
Created January 15, 2011 21:52
Show Gist options
  • Save seanparsons/781306 to your computer and use it in GitHub Desktop.
Save seanparsons/781306 to your computer and use it in GitHub Desktop.
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