scala class类示例代码

代码语言:scala

所属分类:数组

代码描述:scala class类示例代码

代码标签: 示例

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

import java.io._

class Point(val xc: Int, val yc: Int) {
   var x: Int = xc
   var y: Int = yc
   
   def move(dx: Int, dy: Int) {
      x = x + dx
      y = y + dy
      println ("Point x location : " + x);
      println ("Point y location : " + y);
   }
}

class Location(override val xc: Int, override val yc: Int,
   val zc :Int) extends Point(xc, yc){
   var z: Int = zc

   def m.........完整代码请登录后点击上方下载按钮下载查看

网友评论0