public abstract class Vehicle {
public void drive(){
spinTheWheels(subclass.getNumWheels());
}
public void spinTheWheels(int wheelsTotal){
....
}
}
public class Car extends Vehicle {
private final int numWheels = 4;
...
}
在上面的示例中,我想在车辆内引用来自 Car 的 numWheels。这怎么可能?