Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scala> type Location = String
- defined type alias Location
- scala> val loc: Location = "Washington"
- loc: Location = Washington
- // ----
- scala> case class Location(location: String) extends AnyVal
- defined class Location
- scala> val loc: Location = "Washington"
- <console>:9: error: type mismatch;
- found : String("Washington")
- required: Location
- val loc: Location = "Washington"
- ^
- scala> val loc: Location = Location("Washington")
- loc: Location = Location(Washington)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement