code:
Package Comkawrksclkday0l Object patternMatching03 { // when different types of objects need to call different methods, only the type of the matching pattern is useful. goIdle DEF (Device: Device) = Device match { Case P: Phone => p.screenOff Case C: Computer => c.screenSaverOn } } abstract class Device case class Phone(model:String) extends Device{ def screenOff = "Turning screen off" }