如何在此类父类中调用私有方法?我所做的是一个丑陋的代码,但虽然我不认为这是一个真正的解决方案.
非常感谢有关如何做到这一点的一些建议.我已经找到了解决方案,但是没有给我一些明确的问题.
public abstract class Car {
public void passItOn(int a) {
takesVariable(a);
}
private void takesVariable(int a) {
//Process the variables
}
Run Code Online (Sandbox Code Playgroud)
孩子:
public abstract class Wheel extends Car {
boolean a = anotherMethod();
if(value() != a) {
passItOn(a);
}
}
Run Code Online (Sandbox Code Playgroud)
我的收益率存在一些问题,但我在上面!所有人都会给予回复+分数!
| 归档时间: |
|
| 查看次数: |
9566 次 |
| 最近记录: |