#scala
For every case class the Scala compiler generates an equals
method which implements structural equality and a toString
method.
If you want to change selection, open document below and click on "Move attachment"
Case Classes - Scala Documentationxample:
Fun("x", Fun("y", App(Var("x"), Var("y"))))
The constructor parameters of case classes are treated as public values and can be accessed directly.
val x = Var("x")
println(x.name)
<span>For every case class the Scala compiler generates an equals method which implements structural equality and a toString method. For instance:
val x1 = Var("x")
val x2 = Var("x")
val y1 = Var("y")
println("" + x1 + " == " + x2 + " => " + (x1 == x2))
p Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details