Operators Overloading in C++
Operators Overloading in C++
Assignment (=), subscript ([]), function call (()), and member selection (>) operators must be defined as member functions
Unary operators declared as member functions take no arguments; if
declared as global functions, they take one argument.
Binary operators declared as member functions take one argument; if
declared as global functions, they take two arguments.
If an operator can be used as either a unary or a binary operator ( &,
*, +, and -), you can overload each use separately.
Overloaded operators cannot have default arguments.
|
>
>>
-=
*=
->*
*
~
<=
==
/=
<<=
new
/
!
>=
!=
%=
>>=
new []
%
,
++
&&
^=
[]
delete
^
=
-||
&=
()
delete []
::