当前位置:网站首页>Differences between overloads, rewrites, abstract classes and interfaces
Differences between overloads, rewrites, abstract classes and interfaces
2022-06-28 05:59:00 【Coder without code】
heavy load :
A way for classes to handle different types of data in a unified way . Multiple functions with the same name exist at the same time , Determine which method to use according to the number and type of incoming data .
Is a manifestation of polymorphism , Its polymorphism is reflected in judging which method to use according to the number and type of incoming data .
, sex : Same method name , The type or number of parameter lists are different , Independent of return value . Two methods with different return values , In the same class is not considered overloaded , Instead, compilation errors will occur .
rewrite :
Polymorphism between parents and children , Redefining the function of the parent class . That is, a method defined in a subclass has the same name and parameters as its parent class .
If a method in a subclass has the same method name as a method in a parent class 、 Return type and parameter list , Then the new method will cover the original method . If you need the original method in the parent class , You can use super keyword , The keyword refers to the parent class of the current class .
The difference between abstract classes and interfaces :
1. Abstract classes are still a kind of class , There's a way to structure , Only inheritance . It's an abstraction of things , Contains properties and behaviors , That is, you can have non abstract methods and member variables .
2. There can only be abstract methods in an interface , Can't instantiate , Can be implemented .
边栏推荐
- Filecoin hacker song developer competition
- Lenovo hybrid cloud Lenovo xcloud, new enterprise IT service portal
- numpy.reshape, numpy.transpose的理解
- How to add live chat in your Shopify store?
- 猿粉猿动力-开发者活动袭!
- Apple MDM bypass jailfree bypass MDM configuration lock free
- V4l2 driver layer analysis
- 学术搜索相关论文
- Data middle office: construction ideas and implementation experience of data governance
- 不会还有人只会用forEach遍历数组吧?
猜你喜欢
深度学习19种损失函数
5g network overall architecture
Example of MVVM framework based on kotlin+jetpack
JQ picture amplifier
Use of JDBC
At first glance, I can see several methods used by motionlayout
Jenkins continues integration 2
Windows环境Redis使用AOF持久化,无法生成AOF文件,生成后无法加载AOF文件内容
上海域格ASR CAT1 4g模块2路保活低功耗4G应用
Filecoin hacker song developer competition
随机推荐
File foundation - read / write, storage
What are the advantages of e-mail marketing? Why do sellers of shopline independent station attach so much importance to it?
@Autowired注解为空的原因
YYGH-7-用户管理
idea根据数据库表生成实体类
idea创建类时自动添加注释
[untitled]
The length of pytorch dataloader the difference between epoch and iteration
@The reason why the Autowired annotation is empty
数据仓库:DWS层设计原则
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException:异常解决
Jenkins continuous integration 1
OpenSCAP 简介
Windows环境Redis使用AOF持久化,无法生成AOF文件,生成后无法加载AOF文件内容
Enum
Jenkins继续集成2
5GgNB和ng-eNB的主要功能
使用SSM框架,配置多个数据库连接
Data center: Seven Swords of data governance
5g network overall architecture