How to write class in Scala

class Point(xc:Int, yc:Int){
 var x: Int = xc
 var y: Int = yc
 def move(dx:Int, dy:Int){
  x = x+ dx
  y = y+dy
 }
override def toString():String = "(" + x + "," + y + ")";
}

No comments:

Post a Comment