我有以下代码:
case class Foo(x:Int) {
def this(x: Int, y: Int) = this(x + y)
}
object Foo {
def apply(x: Int, y: Int) = new Foo(x, y)
}我收到编译错误:Error:Person is already defined as (compiler-generated) case class companion object Person这段代码必须工作,因为apply有另一个签名。可能是scala中的错误,我的scala版本是2.11.8
https://stackoverflow.com/questions/41429870
复制相似问题