可能重复:
Zip Code Database
Scala: can't write setter without getter?
class Person {
def age_= (val value:Int) { }
}
object Main {
def main( args : Array[String] ) {
val s = new Person()
s.age = 10
}
}
我认为Scala通过允许将其用作bla_=
来对foo.bar = baz
给予特殊处理