当前位置:网站首页>function overloading
function overloading
2022-07-03 16:39:00 【Steal ice cream in the middle of the night】
function overloading
Use The same Function name as Function as Function name of the function of .
for example : Compare the size function of numbers ——— Function name ( fun )
Compare the size of the number
doubt : 1. The type of number ( int / float / double)
2. Number of numbers ( 2 individual 3 individual ……)
These questions distinguish functions The key is :
1. The type of the argument to the function ( It needs to be considered Assignment compatibility The situation of )
2. The number of arguments to the function
Be careful : Maybe someone will question , Why can't the return value of a function be the key to distinguishing functions ?
The compiler depends on the type and number of arguments in the call time statement , Determine the specific function version of the call , Compile phase , The program has not been executed , So I don't know what the return value is , More uncertain about the type .
Be careful : When the parameter is reference
The situation is special when the parameter is reference
a key : Compile time Sure distinguish
void fun(int a,int b) and void fun(double &a,double &b)
Compile time You can't distinguish
void fun(int a,int b) and void fun(int &a,int &b)
Be careful : Is there a problem when the parameter is a pointer, like when the parameter is a reference ?
answer : no !
边栏推荐
- Is it safe to open an account with flush?
- PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
- word 退格键删除不了选中文本,只能按delete
- Register in PHP_ Globals parameter settings
- PHP CI (CodeIgniter) log level setting
- 【剑指 Offer 】57 - II. 和为s的连续正数序列
- nifi从入门到实战(保姆级教程)——flow
- 8 tips for effective performance evaluation
- Simulink oscilloscope data is imported into Matlab and drawn
- Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
猜你喜欢
0214-27100 a day with little fluctuation
word 退格键删除不了选中文本,只能按delete
Le zèbre a été identifié comme un chien, et la cause de l'erreur d'AI a été trouvée par Stanford
PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
面试官:JVM如何分配和回收堆外内存
Daily code 300 lines learning notes day 10
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
Mysql 单表字段重复数据取最新一条sql语句
Initial test of scikit learn Library
[combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi
随机推荐
Initial test of scikit learn Library
2022爱分析· 国央企数字化厂商全景报告
ThreeJS 第二篇:顶点概念、几何体结构
Caching mechanism of Hibernate / session level caching mechanism
Register in PHP_ Globals parameter settings
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (III)
消息队列消息丢失和消息重复发送的处理策略
程序猿如何快速成长
Leetcode binary search tree
探索Cassandra的去中心化分布式架构
相同切入点的抽取
What is the maximum number of concurrent TCP connections for a server? 65535?
跟我学企业级flutter项目:简化框架demo参考
线程池执行定时任务
8个酷炫可视化图表,快速写出老板爱看的可视化分析报告
Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
14 topics for performance interviews between superiors and subordinates (4)
如何在本机搭建SVN服务器
[combinatorics] polynomial theorem (polynomial theorem | polynomial theorem proof | polynomial theorem inference 1 item number is the number of non negative integer solutions | polynomial theorem infe
关于视觉SLAM的最先进技术的调查-A survey of state-of-the-art on visual SLAM