Get the App
SLTechnology News&Howtos  ›  Development  › 

How to thoroughly sort out the overloaded function matching of C++

Shulou Source: shulou.com Published: 2022-06-03 19:25:14 09月30日 Update

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

Tags: Function type feasibility precision result run arithmetic formal parameter two example content time comment problem face same three between ambiguity can be passed through Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Redmi Huawei Shulou Information Shulou Tech Info