I have an abstract class as below -:
public class AbstractClass{
private String getA(){
return "A";
}
protected String getB(){
return getA().concat("-B");
}
}
Now, all subclasses will use getB() method. That is why I have made it as protected. But not all subclasses will use getA() method. Only a subset will use it. So, should I still make it protected or keep it private?
Aucun commentaire:
Enregistrer un commentaire