当前位置:网站首页>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 !
边栏推荐
- Aike AI frontier promotion (7.3)
- Golang anonymous function use
- Golang 装饰器模式以及在NSQ中的使用
- Page dynamics [2]keyframes
- The mixlab editing team is recruiting teammates~~
- Caching mechanism of Hibernate / session level caching mechanism
- 手机注册股票开户安全吗 开户需要钱吗
- Thinking about telecommuting under the background of normalization of epidemic | community essay solicitation
- (补)双指针专题
- [sword finger offer] 58 - I. flip the word order
猜你喜欢

Record a jar package conflict resolution process

拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。

斑马识别成狗,AI犯错的原因被斯坦福找到了

TCP擁塞控制詳解 | 3. 設計空間

What is the material of 13mnnimor? 13mnnimor steel plate for medium and low temperature pressure vessels

One article takes you to understand machine learning

Yu Wenwen, Hu Xia and other stars take you to play with the party. Pipi app ignites your summer

NSQ source code installation and operation process

Cocos Creator 2.x 自动打包(构建 + 编译)

2022爱分析· 国央企数字化厂商全景报告
随机推荐
TCP拥塞控制详解 | 3. 设计空间
Arduino esp32: overall framework of lvgl project (I)
【剑指 Offer 】64. 求1+2+…+n
NLP four paradigms: paradigm 1: fully supervised learning in the era of non neural networks (Feature Engineering); Paradigm 2: fully supervised learning based on neural network (Architecture Engineeri
Unity project optimization case 1
1287. Elements that appear more than 25% in an ordered array
Svn usage specification
2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
TCP congestion control details | 3 design space
PHP中register_globals参数设置
Basis of target detection (IOU)
nifi从入门到实战(保姆级教程)——flow
Is it safe to open an account with flush?
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
How to initialize views when loading through storyboards- How is view initialized when loaded via a storyboard?
Unreal_ Datatable implements ID self increment and sets rowname
架构实战营 - 第 6 期 毕业总结
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
Custom plug-in construction and use of QT plug-in
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。