Please consider the following situation:
class A{
private int num = 10;
public int getNum(){ return num; }
public void setNum(int num){ this.num = num; }
}
class B extends A{
private int num;
public B(){
num = getNum();
}
}
In Java, a way for a subclass to have access to the superclass' private members, without declaring them protected
(since that will expose them to the entire package), could be to use the superclass' getters and setters. Not only in the subclass' constructor, but anywhere needed.
Is this something used by people? Common? Have you ever seen this?