next up previous contents
Next: Overriding Methods as a Up: Polymorphism Previous: Overloading Methods as a   Contents

Overloading of Operators

Polymorphism of this kind is available in many non-OOP languages. In C, for instance, we use ``+'', plus operator to add any kind of data. This form of polymorphic behaviour has been intrinsic to the language and could not be modified or controlled by the programmer.

C++ provides the opportunity, and (with one or two exceptions) the responsibility for the programmer to define the behaviour of almost any operator that may be applied to an object of a new class.

JAVA does not support operator overloading although in many cases overloaded operators will provide a much cleaner and more intuitive syntax.



Olexiy Ye. Tykhomyrov 2001-12-16