Operator Overloading

Operator Overloading

Without changing the functionality of operators,
we can overload (extend) operators.
for instance, By Overloading + Operator ,
we can add two Strings or struct type variables.
This is done by defining operator function.

Syntax:
operator ()

example:
int operator + (1,2)

Limitations:
a. We can overload some set of operators only.
That is, Some exceptional are there(eg. :: operator).
b. We shouldn’t use operator overloading for unobvious relationships
(eg. multiplication of two string ).

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.