Richard Quadling wrote: >> On 02/08/06, Hartmut Holzgraefe <[EMAIL PROTECTED]> wrote: >> Is function overloading really "an OOP thing"?
I think so, I've only ever used it within Delphi, so my POV may be skewed.
proving by example? ;)
To quote http://www.codeproject.com/soap/RefAndOL.asp "For a language to be said .NET complaint, it should be truly object oriented and therefore must support polymorphism. Method overloading is one of the pillars of polymorphism. Overloading means methods with the same name but different parameters. Just as we overload methods in regular applications, we can overload XML WebMethods also." I've always considered it to be the case.
You are mixing concepts here. Yes, function overloading is crucial to polymorphism. And OO languages usually heavily rely on polymorphism. But does that make polymorphism an OO feature? Polymorphism does exist outside the OO world, e.g. in functional languages. Whether it is crucial for OO is a different question ... But even then we have different types of polymorphism to look at. What you are requesting is ad-hoc polymorphism, there are other classes of polymorphism though ... e.g. PHP userland functions without type hints are already polymorph in that they accept any number of arguments of any type. PHP will issue a warning if you call such a function with less parameters than specified in the functions parameter list, but you cann still call it nevertheless. This qualifies as a form of parametric polymorphism which is the other major kind of polymorphism besides ad-hoc polymorphism. PS: your quoting style sucks. please put your answers *below* the question -- Hartmut Holzgraefe, Senior Support Engineer . Hauptsitz: MySQL GmbH, Radlkoferstr. 2, D-81373 München Geschäftsführer: Hans von Bell, Kaj Arnö - HRB München 162140 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php