9 Years
Discussion Span
Last Post by pirbhat.ariya

Binary operations are operations between two variables (like a+b, a-b, a^b, a/b etc.).
Unary operations are operations on one variable (a++, a-- ...)


Hi, operator++(int) and operator++() are the post and pre increment signatures respectively.

Note that the (int) in the post-increment does not get assigned or used
i.e. you might write

class A

   A& operator++(int) 
      // do stuff here; 
      return *this;

Note: You do not need to return a reference to the class, you can return anything you want.

Can I strongly recommend getting a basic c++ book (see the FAQ on this section).


how to overload bitwise i.e << and >> operators ?

The same way you overload any other binary operator. There's no magic to the shift operators, though if you're not careful then precedence rules might bite you in the ass when you use them.


Look at this list of C++ operators, it shows all the operators (binary and unary) in C++ along with the prototypes for the member and non-member version of the operator overload functions. That might be a quicker reference for you than asking us for each operator.


someone please define operator overloading deeply,how it works which operators are used and which are not in c++

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.