tel me the difference between binary and unary operator

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-- ...)

how to overload post and preincrement operators ?

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
{
  public:

   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 ?

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++

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.