1, 因为 default 类型比 protected 类型范围小, default 只能被同一package的类调用,而protected 还可以被子类调用.在进行override时, overriding 函数的类型不能比overrided的函数"窄"!2.机不是override ,也不是 overload, if override, the return type should be the same; if overload , the argument type should be different!
71.即非overriding 也非overload,compile error.
protected void setVar (float f) {x = f;}
说明是保护,既然class SubClass exyends BaseClass ,那么sub继承了base,那么void setVar (float f) {x = f;}变成私有,a可以直接写了。
public final void setVar(float f) {x = f;}对这个函数最后定义。
71不是c就是b。
我也拿不准了,高手阿,指点一下。
考虑b是因为面向对象讲继承时候对继承中的重载提了几句。
你们说的具体点嘛?
重写不能更加严格。2、返回类型不能做为重载的因素。
69:c,e
71:c
2:C(Overriding和Overloading都不允许有相同参数和函数名而有不同返回值。要不然,若你写:String a = "hello" + func(temp);其中的func(temp)的返回值用什么?)