Documentation here says
private This is the default, and means that the method or variable is accessible only within the Apex class in which it is defined. If you do not specify an access modifier, the method or variable is private. protected This means that the method or variable is visible to any inner classes in the defining Apex class, and to the classes that extend the defining Apex class.
but i can do this
public class outerclass{
private integer pri;
protected integer pro;
public class innerclass{
public innerclass()
{
outerclass obj = new outerclass();
obj.pri = 6; //can access private
obj.pro = 7;
}
}
}
As seen above i can access private variables of my outer class in my inner class. Is this a documentation error?