這可能達到?如果是,請更正我的Foo聲明語法。我可以在Scala類中定義一個無名方法嗎?
class Foo (...) {
...
def /* the nameless method name implied here */ (...) : Bar = new Bar (...)
...
}
class Bar (...) {
...
}
val foo : Foo = new Foo (...)
val fooBar : Bar = foo (...)
只是爲了澄清,有圖中有兩個定義。 'currentSeconds'這裏是一個*匿名函數*,它基本上是'anonfun0'顯示的定義的語法糖 – 2010-10-22 19:39:48