// Constructor values, immutable x, mutable y class Point(val x : Int, var y : Int) { def getX() = x def getY() = y override def toString() = { "(" + x + "," + y + ")" } } // And ColorPoints... class ColorPoint(val color : String, x : Int, y : Int) extends Point(x,y) { override def toString() = { super.toString() + " -- " + color } } object PointMain { def main(args : Array[String]) = { val p = new ColorPoint("red",0,0) p.y = 2 println(p.toString()) } }