Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is operator overloading Polymorphism?
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00554986
Message ID:
00555826
Views:
17
Just another thought - the operations being performed are different, which veers me away from the polymorphism definition, now if "1" + "1" = "2", I would be more likely to accept it.

>Thanks Len. Its probably one of those things that can't be understood from the textbook definition, only from wrestling with some examples for a while.
>
>
>>>Example:
>>>
>>>1 + 1 = 2
>>>"1" + "1" = "11"
>>>
>>>This is clearly an example of overloading the "+" operator, but is it polymorphic?
>>
>>The definition of polymorphism is a very grey area, IMO opinion, the example is not polymorphism, but is operator overloading - though some definitions of overloading describe it as a type of polymorphism. (e.g. http://webopedia.internet.com/TERM/p/polymorphism.html).
>>
>>James Booth's description of 'ad hoc polymorphism' may be relevant.
>>http://jamesbooth.com/oop.htm
>>
>>My main objection to it being polymorphism, is that integers are a fundamental type & as such + is not really a method. But that probably reflects my background (Pascal/C/C++), so not being polymorphic is only an opinion not something I would state as a fact.
Len Speed
Previous
Reply
Map
View

Click here to load this message in the networking platform