所以,我今天刚开始学习Scala,并且表现相当不错,但是我遇到了这个问题......
我需要在Scala中执行此操作,但我无法将其整理出来:
final Filter<GameObject> filter = new Filter<GameObject>() {
public boolean accept(GameObject o) {
...
}
};
Run Code Online (Sandbox Code Playgroud)
ATM我有,但它甚至不会编译:
val filter = new Filter[GameObject] {
override def accept(o: GameObject) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
编辑:
到目前为止,这是整个对象:
object Targeter extends LoopTask {
val filter = new Filter[GameObject] {
override def accept(o: GameObject) = { true }
}
// Overriding a method in the LoopTask class
override def loop() = {
100
}
}
Run Code Online (Sandbox Code Playgroud)