Talk:Function overloading

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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)[reply]

"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)[reply]