开发者

Possible compilation errors in C++ [closed]

开发者 https://www.devze.com 2023-01-08 06:04 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_JS百科 Closed 12 years ago.

In C++, what kind of compilation errors might I run into while using function overloading, and when might these occur?


This website has a couple listed, though I think your question will probably get closed as not a real question:

http://net.pku.edu.cn/~course/cs101/resource/CppHowToProgram/5e/html/ch06lev1sec17.html

  1. Creating overloaded functions with identical parameter lists and different return types is a compilation error.

  2. A function with default arguments omitted might be called identically to another overloaded function; this is a compilation error. For example, having in a program both a function that explicitly takes no arguments and a function of the same name that contains all default arguments results in a compilation error when an attempt is made to use that function name in a call passing no arguments. The compiler does not know which version of the function to choose.

0

精彩评论

暂无评论...
验证码 换一张
取 消