c++ class : operator code example

Example: operator c++

Common operators
assignment | increment | arithmetic |  logical | comparison | member | other
		   | decrement |            |		   |		    | access |
-----------------------------------------------------------------------------                            
  a = b    |    ++a    |     +a	    |	 !a	   |   a == b   |  a[b]  | a(...)
  a += b   |	--a	   |     -a		|  a && b  |   a != b   |   *a   |  a, b
  a -= b   |	a++	   |   a + b	|  a || b  |   a < b    |   &a   |  ? :
  a *= b   |	a--	   |   a - b	|	       |   a > b    |  a->b  |
  a /= b   |		   |   a * b	|	       |   a <= b	|  a.b   |
  a %= b   |		   |   a / b	|		   |   a >= b	|  a->*b |
  a &= b   |		   |   a % b	|		   |   a <=> b	|  a.*b  |
  a |= b   |		   |     ~a		|		   |		    |		 |
  a ^= b   |		   |   a & b	|		   |   		    |		 |
  a <<= b  |		   |   a | b	|		   |			|		 |
  a >>= b  |		   |   a ^ b	|		   |			|		 |     
   		   |		   |   a << b	|		   |			|		 |  
     	   |		   |   a >> b	|		   |			|		 |

Tags:

Cpp Example