当前位置:网站首页>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 !
边栏推荐
- 在ntpdate同步时间的时候出现“the NTP socket is in use, exiting”
- LeetCode1491. Average value of wages after removing the minimum wage and the maximum wage
- "Everyday Mathematics" serial 56: February 25
- The mixlab editing team is recruiting teammates~~
- Idea configuration plug-in
- How programming apes grow rapidly
- Mongodb installation and basic operation
- Deep understanding of grouping sets statements in SQL
- What material is 12cr1movr? Chemical property analysis of pressure vessel steel plate 12cr1movr
- NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
猜你喜欢

IDEA-配置插件

跟我学企业级flutter项目:简化框架demo参考

Mysql 将逗号隔开的属性字段数据由列转行

Initial test of scikit learn Library

Data driving of appium framework for mobile terminal automated testing

2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises

2022爱分析· 国央企数字化厂商全景报告

Visual SLAM algorithms: a survey from 2010 to 2016

Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..

word 退格键删除不了选中文本,只能按delete
随机推荐
NSQ源码安装运行过程
2022.02.14_ Daily question leetcode five hundred and forty
Top k questions of interview
Golang decorator mode and its use in NSQ
Page dynamics [2]keyframes
Golang 装饰器模式以及在NSQ中的使用
One article takes you to understand machine learning
[sword finger offer] 58 - I. flip the word order
MongoDB 的安装和基本操作
【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事
TCP congestion control details | 3 design space
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
Thinking about telecommuting under the background of normalization of epidemic | community essay solicitation
在ntpdate同步时间的时候出现“the NTP socket is in use, exiting”
PHP CI (CodeIgniter) log level setting
What is the pledge pool and how to pledge?
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
Yu Wenwen, Hu Xia and other stars take you to play with the party. Pipi app ignites your summer
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
8 cool visual charts to quickly write the visual analysis report that the boss likes to see