Scala Object

From GM-RKB
(Redirected from Scala Object Structure)
Jump to navigation Jump to search

A Scala Object is a software object that is a Scala data structure.



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)
}