• Welcome to Valhalla Legends Archive.
 

Function Overloads == Polymorphism?

Started by MyndFyre, July 24, 2004, 09:05 PM

Previous topic - Next topic

MyndFyre

I say no.

TheMinistered and I were having a debate about whether overloaded functions are a feature of polymorphic languages.  I say no -- you can have a language that supports function overloads but is not polymorphic.  VB6 *in theory* could support function overloads, just by having different parameters.  But it's not a polymorphic language because you can't have one type change the base type's behavior.

This is my best example of polymorphism:

In Beta 1, the ProfileEx class contains ALL of the information required for my bot.  It implements about 6 interfaces: IDisplaySettings, IConnectionSettings, ICommandSettings, etc.  I pass ProfileEx to functions that don't know of the existence of ProfileEx, but do know of the existence of their respective interfaces.  So, I say, .SetDisplaySettings(myProfile) where the SetDisplaySettings method takes an IDisplaySettings parameter.  In some instances, ProfileEx behaves solely as display settings.  Others, solely as command settings, or connection settings.  None of those are aware of the existence of a ProfileEx class.  That's what it means, for something to have many forms.

I fail to see how that has anything to do with overloaded functions.  :P

[edit] My bad Tuber, I got you and TheMinistered confused. [/edit]
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Tuberload

#1
When exactly did I debate this with you?

Addition: What are you talking about anyways? I do not program in VB whatsoever.

Final addition: Ok that makes much more sense. Everyone please ignore my comments.
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

StrifeOS

Function overloading allows you to use the same function interface (name) for different implementations (definition).  Actually, I guess the parameter list is part of the interface too, but that's just a small example.  I'd actually see it more fit as function overiding as function polymorphism, not function overloading.  I'm not absolutely sure how it ever came to be known as function polymorphism though.

Maddox

Overloading functions does not allow objects to "morph" into other ones, so no, I don't see it as a feature of polymorphism. It is simply a feature of a language.
asdf.

Arta

I don't think overloading is polymorphism either.

warz

I dont think polymorphism is overloading. No. I think morphing is cool though. I'd like to morph into a bird; a bird of prey.. and eat humans.

Adron

I think function overloads is an example of polymorphism.

Tuberload

Quote from: Adron on July 25, 2004, 12:12 PM
I think function overloads is an example of polymorphism.

I agree because the definition of polymorphism is many forms, and function overloading allows there to be many forms of one function. I believe the exact term is Ad-hoc polymorphism but I could be wrong.
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

dxoigmn

#8
Quote from: Tuberload on July 25, 2004, 02:35 PM
Quote from: Adron on July 25, 2004, 12:12 PM
I think function overloads is an example of polymorphism.

I agree because the definition of polymorphism is many forms, and function overloading allows there to be many forms of one function. I believe the exact term is Ad-hoc polymorphism but I could be wrong.

I believe you're correct.  And I do agree function overloading is a form of polymorphism.

http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29