//cls_a is defined by system framework, so we cannot change its definition
public class cls_a {
public void method_a();
}
//I add a new cls_b implemenation and would like to
//add a new method_a(int) function
//and prevent client side to access cls_a.method_a()
public class cls_b extends cls_a {
public void method_a(int a) {
//do something for a
method_a();
}
}
//client side
cls_b b = new cls_b();
b.method_a(2); //it's okay
b.method_a(); //should give something error when compiling code
クライアントcls_b
側でb.method_a()
. Javaでそれを行う方法を知っている人はいますか?