当前位置:网站首页>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 !
边栏推荐
- Client does not support authentication protocol requested by server; consider upgrading MySQL client
- Is it safe to open an account with tongdaxin?
- 什么是质押池,如何进行质押呢?
- Is it safe to open a stock account by mobile registration? Does it need money to open an account
- Preventing/catching “IllegalArgumentException: parameter must be a descendant of this view” error
- 爱可可AI前沿推介(7.3)
- Initial test of scikit learn Library
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
- There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them
- How programming apes grow rapidly
猜你喜欢
The mixlab editing team is recruiting teammates~~
What is the maximum number of concurrent TCP connections for a server? 65535?
ThreeJS 第二篇:顶点概念、几何体结构
Idea configuration plug-in
Interviewer: how does the JVM allocate and recycle off heap memory
Explore Netease's large-scale automated testing solutions see here see here
消息队列消息丢失和消息重复发送的处理策略
Record windows10 installation tensorflow-gpu2.4.0
Data driving of appium framework for mobile terminal automated testing
QT serial port UI design and solution to display Chinese garbled code
随机推荐
LeetCode1491. Average value of wages after removing the minimum wage and the maximum wage
Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
2022爱分析· 国央企数字化厂商全景报告
跟我学企业级flutter项目:简化框架demo参考
How to initialize views when loading through storyboards- How is view initialized when loaded via a storyboard?
JSON 与 BSON 区别
SVN使用规范
[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
关于视觉SLAM的最先进技术的调查-A survey of state-of-the-art on visual SLAM
【剑指 Offer】58 - I. 翻转单词顺序
PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
探索Cassandra的去中心化分布式架构
(补)双指针专题
利用MySQL中的乐观锁和悲观锁实现分布式锁
Add color to the interface automation test framework and realize the enterprise wechat test report
8 cool visual charts to quickly write the visual analysis report that the boss likes to see
【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事
MongoDB 的安装和基本操作
Page dynamics [2]keyframes
nifi从入门到实战(保姆级教程)——flow