Scala Immutable Object
Jump to navigation
Jump to search
A Scala Immutable Object is a Immutable Object that is a Scala object.
References
2013
- (2013, Melli)
trait Versioned { def version : Int def nextVersion = version + 1 } case class Customer(name: String, version : Int = 0) extends Versioned { def withName(newName: String) = copy(name = newName, version = nextVersion) }