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

  • 相关阅读:
    谷歌浏览器本地调试时调用服务跨域
    SVN提交时忽略不必提交的文件夹和文件,如node_modules
    热点链接实现不规则菜单
    easyui分页控件的应用
    Filter过滤器的应用
    SVG绘图学习总结
    VS2010无法调试页面问题
    java学习
    webservice配置
    jQuery
  • 原文地址:https://www.cnblogs.com/lxw0109/p/java_polymorphism.html
Copyright © 2011-2022 走看看