changeset 44 | a751aa1ee4f7 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Fahad/CodeSamples/Classes.scala Sun Nov 09 19:25:10 2014 +0000 @@ -0,0 +1,20 @@ +package Main + +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 + ")"; +} + +object Classes{ + def main(args: Array[String]){ + val pt = new Point(1,2) + println(pt) + pt.move(10,10) + println(pt) + } +} \ No newline at end of file