How to thoroughly sort out the overloaded function matching of C++
Editor to share with you how C++ thoroughly sorted out the overloaded function matching, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article. Next, let's go to know it!
Matching process
In order to facilitate the explanation, the function matching is divided into three stages, the candidate function is determined, the feasible function is determined, and the best matching function is determined.
Determine the candidate function
The candidate function has the same name as the called function, and its declaration is visible at the calling point. Give me a simple example.
Suppose you have two files, 1.cpp and 2.cpp, with the following contents:
1.cpp:
/ / function 1 void f (int ASCI short b) {cout