1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
class Outer extends Application { val y: Int = 1 abstract class C { val x: Int } val foo = new C { class I { val z = y } val x = (new I).z } } object Test extends Application { val o = new Outer println(o.foo.x) }