OOPortal
J2EEOnline RationalDB
prev prev
  Course navigation
  Overloading binary operators
Generally speaking, you should overload symmetrical binary operators, such as
  1. +,
  2. *,
  3. ==,
  4. !=,
or && with friend functions. Both arguments are then passed as ordinary parameters. This subjects both arguments to the same rules of parameter passing.
Recall that using a member function to provide overloading for symmetrical binary operators causes the first argument to be passed via the this pointer.
  Course navigation