Talk:Function overloading

From Wikipedia, the free encyclopedia
Jump to: navigation, search
edit·history·watch·refresh Stock post message.svg To-do list for Function overloading:

Here are some tasks awaiting attention:
WikiProject Computer science  
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
 ???  This article has not yet received a rating on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
 

Should there be a different section for Constructor overloading at the very beginning because its done syntactically in the same way. so there should be general function overloading at the first section I think. then method overloading and constructor overloading at the end.

"How-to" flag[edit]

I've removed the how-to flag after changing the constructor example, adopting an example from the old page Overload (programming) (which I merged with this page as well as Operator overloading) which I think fixes the problem of the "how-to guide" tone. I also introduced some content from that page in the article's introduction, which I'm not sure about. Specifically, I don't know if using italics for method calls is too visually jarring. I'm open to suggestions there. Dindon (talk) 21:32, 20 February 2009 (UTC)

[edit]

"A common error would be to assign a default value to the object in the second method, which would result in an ambiguous call error, as the compiler wouldn't know which of the two methods to use." I'm not sure what this means. Is it talking about a language that has optional parameters that can default to values? i.e: Python:

def f(x=0):
    return x+1

I presume that this is what is being referred to. If there was also a 'def f():', then where the code calls 'f()' - does it mean 'f()' or 'f(0)'? However, I would expect the compiler or interpreter to flag this ambiguity as an error. Sawatts (talk) 10:15, 6 May 2014 (UTC)