zoukankan      html  css  js  c++  java
  • Overload and Override without Overwrite

    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

  • 相关阅读:
    Windows Python+Eclipse环境配置
    infobright系列二:数据迁移
    infobright系列一:源码安装infobright
    autotools归纳
    Atlas系列一:Atlas功能特点FAQ
    C#反射技术概念作用和要点
    .net获取本机公网IP代码
    Java泛型-类型擦除
    现在就使用HTML5的十大原因
    让网页图片变灰色的三种方法
  • 原文地址:https://www.cnblogs.com/lxw0109/p/java_polymorphism.html
Copyright © 2011-2022 走看看