C++ Programming & Tutorials for Beginners

Operator Overloading

Home  »  C++ Programming  »  Operator Overloading


     Just like the functions are being overloaded, the operator can also be overloaded in C++. Operator overloading means, given additional meanings to the operators like +,*,<=,+= when dealing with objects of user-define-class or in other words, the operators perform more than their conventional role.

Assignment operator
Arithmetic operator
Relational operator
Logical operator
Bitwise operator
Increment & Decrement operator
Special operator
=
+
-
*
/
%
+=
-=
*=
/=
%=
<
<=
>
>=
==
!=
!
&&
||
&
|
~
^
<<
>>
<<=
>>=
&=
=
^+
++
--
,
[]
()
->
->*
new
new[]
delete[]
delete[]

Overloadable Operator


The simple example of Operator overloading is given below :





another example :







Previous
Next Post »