Код: Выделить всё
public class A
{
private void foo(){}
}
Я хочу, чтобы foo() был скрыт от B, так что все работает нормально, я не могу позвонить:
Код: Выделить всё
new B().foo()
Код: Выделить всё
public class A
{
private void foo(){}
public void bar(){
new B().foo(); //this compiles, I don't want it to be possible
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... base-class