I have checked this post but have some confusions regarding the usage rules of operator overloading.
For example, here are some usage restrictions:
void operator() ()
- Can overload '()' operator without any parameters.
- Must used on the'right' of the operand.
void operator+ ()
Can overload '+' operator without any parameters.
Must be on the 'left' of the operand.
void operator << (int val)
Must have 1 parameter. Cannot be 0 parameters or 2 parameter. Only 1 parameter.
Must be used on the right of the operand.
These are just few of the rules in operator overloading. I would appreciate if someone could direct me to a reference or explain the rules governing each type of these operators. Why some operators must have one parameter and why '()' must be used on the right of the operand while '+' must be used on the left of the operand.
Thank you very much.