当前位置:网站首页>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 !
边栏推荐
- 【LeetCode】94. Middle order traversal of binary tree
- 线程池执行定时任务
- Learn from me about the enterprise flutter project: simplified framework demo reference
- Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
- Is it safe to open a stock account by mobile registration? Does it need money to open an account
- Mysql 单表字段重复数据取最新一条sql语句
- utfwry. Dat PHP, about ThinkPHP's method of IP location using utfwry address Library
- nifi从入门到实战(保姆级教程)——flow
- Mysql 将逗号隔开的属性字段数据由列转行
- Arduino esp32: overall framework of lvgl project (I)
猜你喜欢

QT serial port UI design and solution to display Chinese garbled code
![[solved] access denied for user 'root' @ 'localhost' (using password: yes)](/img/71/1ff8ed1d773da99054310f96dca3f8.jpg)
[solved] access denied for user 'root' @ 'localhost' (using password: yes)

Explore Cassandra's decentralized distributed architecture

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

What is the maximum number of concurrent TCP connections for a server? 65535?

Add color to the interface automation test framework and realize the enterprise wechat test report

爱可可AI前沿推介(7.3)

First knowledge of database

Basis of target detection (IOU)

(补)双指针专题
随机推荐
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
[combinatorics] polynomial theorem (polynomial coefficients | full arrangement of multiple sets | number of schemes corresponding to the ball sub model | polynomial coefficient correlation identity)
QT串口ui设计和解决显示中文乱码
Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
The word backspace key cannot delete the selected text, so you can only press Delete
Initial test of scikit learn Library
【LeetCode】94. Middle order traversal of binary tree
word 退格键删除不了选中文本,只能按delete
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
To resist 7-Zip, list "three sins"? Netizen: "is the third key?"
Myopia: take off or match glasses? These problems must be understood clearly first
Explore Cassandra's decentralized distributed architecture
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (III)
Golang decorator mode and its use in NSQ
[sword finger offer] 58 - I. flip the word order
Le zèbre a été identifié comme un chien, et la cause de l'erreur d'AI a été trouvée par Stanford
Construction practice camp - graduation summary of phase 6
PHP converts a one-dimensional array into a two-dimensional array