当前位置:网站首页>The difference between overloading and rewriting
The difference between overloading and rewriting
2022-07-06 13:39:00 【Wake up duck, did you program today?】
First , This question is often asked in interviews , But there is nothing between the two
heavy load :
Occurs in the same class , Method name must be the same , Different reference types , The number is different. , Different order , Method return value and decoration can be different , Occurs at compile time .
rewrite :
Occurs in a parent-child class , Method name , The parameter list can be different , The return value range is less than or equal to the parent class , A subclass cannot throw more exceptions than its parent class , The subclass access modifier range is greater than or equal to the parent class ; If the parent method access modifier is private, Then the subclass cannot override the method
The following situation is also wrong , Will report a mistake :
// The following compilation will report errors
public int add(int a,int b)
public String add(int a,int b)The above is my understanding of the difference between rewriting and overloading , If some friends have a better understanding , You can leave a message in the comment area !!!
边栏推荐
- 透彻理解LRU算法——详解力扣146题及Redis中LRU缓存淘汰
- CorelDRAW plug-in -- GMS plug-in development -- Introduction to VBA -- GMS plug-in installation -- Security -- macro Manager -- CDR plug-in (I)
- 1.C语言矩阵加减法
- Quickly generate illustrations
- Smart classroom solution and mobile teaching concept description
- Cloud native trend in 2022
- 7. Relationship between array, pointer and array
- Arduino+ water level sensor +led display + buzzer alarm
- Share a website to improve your Aesthetics
- MySQL limit x, -1 doesn't work, -1 does not work, and an error is reported
猜你喜欢

编写程序,模拟现实生活中的交通信号灯。
![[面试时]——我如何讲清楚TCP实现可靠传输的机制](/img/d6/109042b77de2f3cfbf866b24e89a45.png)
[面试时]——我如何讲清楚TCP实现可靠传输的机制

1.C语言矩阵加减法

(原创)制作一个采用 LCD1602 显示的电子钟,在 LCD 上显示当前的时间。显示格式为“时时:分分:秒秒”。设有 4 个功能键k1~k4,功能如下:(1)k1——进入时间修改。

(超详细二)onenet数据可视化详解,如何用截取数据流绘图

3.C语言用代数余子式计算行列式

4. Binary search

4.二分查找

3. C language uses algebraic cofactor to calculate determinant

Tyut Taiyuan University of technology 2022 "Mao Gai" must be recited
随机推荐
13 power map
学编程的八大电脑操作,总有一款你不会
[面試時]——我如何講清楚TCP實現可靠傳輸的機制
Decomposition relation model of the 2022 database of tyut Taiyuan University of Technology
使用Spacedesk实现局域网内任意设备作为电脑拓展屏
PriorityQueue (large root heap / small root heap /topk problem)
3.C语言用代数余子式计算行列式
The latest tank battle 2022 full development notes-1
Atomic and nonatomic
1.初识C语言(1)
1.C语言初阶练习题(1)
View UI plus releases version 1.1.0, supports SSR, supports nuxt, and adds TS declaration files
MySQL事务及实现原理全面总结,再也不用担心面试
1.C语言矩阵加减法
List set map queue deque stack
Comparison between FileInputStream and bufferedinputstream
2. Preliminary exercises of C language (2)
IPv6 experiment
MySQL lock summary (comprehensive and concise + graphic explanation)
Redis的两种持久化机制RDB和AOF的原理和优缺点