这可能达到?如果是,请更正我的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