override 和 overload 区别
时间: 2023-12-08 16:05:01 浏览: 192
重写(Overriding)和重载(Overloading)是Java多态性的不同表现。重载发生在一个类中,方法名相同,但各自的参数不同,称为重载。重写发生在子类与父类之间,要求子类被重写方法与父类被重写方法有相同的参数列表,有兼容的返回类型,比父类被重写方法更好访问,不能比父类被重写方法声明更多的异常。重载对返回类型没有特殊的要求,不能根据返回类型进行区分。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [Java 重写(Override)与重载(Overload)](https://blog.csdn.net/weixin_30847271/article/details/101852544)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *2* [【软件构造】override和overload区别](https://blog.csdn.net/weixin_52966993/article/details/124827752)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *3* [重载(Overload)与重写(Override)的区别](https://blog.csdn.net/weixin_52754604/article/details/122968798)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文