Overload and Override without Overwrite - Java

Override(覆盖/覆写): 子类Override父类中的函数(方法)。
Overload(重载): 同一个类中包含多个同名的函数(方法), 但各个函数的参数列表不同。

Override和Overload是Java多态性的不同表现:
Override是父类与子类之间多态性的表现; Overload是同一个类中多态性的表现。
Override是运行时多态;Overload是编译时多态。

Overwrite:Java中就没有它的存在, Java官方文档没有该词的出现, 但是国外有人把Overwrite解释为Override。
"Overriding, which is what I think you mean by 'overwriting' is the act of providing a different implementation of a method inherited
from a base type, and is basically the point of polymorphism by inheritance."

A good explanation on StackOverflow is as follow:
"If you're replacing one implementaion completely with another, it's 'overwriting' or more commonly 'replacing'. If you're replacing
an implementation with another for some specific cases, it's 'overriding'.
To 'overwrite' something is to put something else in its place, destroying the thing overwritten. To 'override' something is to cause
something else to operate instead of it without harming or changing the thing overridden."

参考:
java override overwrite与overload: http://bijian1013.iteye.com/blog/1924157

posted @ 2014-05-11 15:15  XiaoweiLiu  阅读(668)  评论(0编辑  收藏  举报