标签: scala visibility modifiers
如何为子类创建一个字段,但是对于它们的内部类是不可见的?
class Foo class Parent { protected val x = 5 } class Sub extends Parent { println(x) // 5 new Foo { println(x) // it's 5, but I want it to be a compiler error... } }