我似乎无法从内部类引用中获取外部类成员:
class Outer(st: Int)
{
val valOut = st
def f = 4
class Inner { val x = 5 }
}
object myObj {
val myOut = new Outer(8)
val myIn = new myOut.Inner
val myVal: Int = myIn.valOut//value f is not a member of ... myOut.Inner
val x = myIn.f//value valOut is not a member of ... myOut.Inner
}
我已经在包内尝试过这个,并且在 eclipse 工作表中都不起作用。我在 Eclipse 3.7.2 中使用 Scala 2.10.0RC1 和 Scala 插件 2.1.0M2