-1
爲什麼不編譯?斯卡拉錯誤:構造函數被定義兩次
class Name(val name: Int, val sub: Int) {
def this() {
this(5, 5)
}
def this(name: Int) {
this(name, 5)
}
def this(sub:Int){
this(5, sub)
}
}
錯誤:
.scala:15: error: constructor Name is defined twice
conflicting symbols both originated in file '.scala'
def this(sub:Int){
^