Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (17 sloc) 486 Bytes
package scalaBasics.objectOriented
object CaseClasses extends App {
case class Person(name: String, age: Int)
val jim = new Person("Jim", 34)
println(jim.name)
println(jim.toString)
println(jim)
val jim2 = new Person("Jim", 34)
println(jim == jim2) // returns true
val jim3 = jim.copy(age = 45)
println(jim3)
val thePerson = Person
val mary = Person("Mary", 23)
case object UnitedKingdom {
def name: String = "The UK of GB and NI"
}
}
You can’t perform that action at this time.