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

  • 相关阅读:
    Solr环境配置
    SolrJ解析MoreLikeThis查询结果
    思维导图软件PersonalBrain 6.0.6.4破解版使用
    离散对数-详解
    转:pptp和l2tp的区别
    DiffieHellman Key Exchange (DH)源代码
    磁盘IOPS计算
    转:TCP/IP Network Performance Benchmarks and Tools
    转:弄清楚你的业务类型——OLTP or OLAP
    U8软件的端口
  • 原文地址:https://www.cnblogs.com/lxw0109/p/java_polymorphism.html
Copyright © 2011-2022 走看看