7
Contributors
7
Replies
17
Views
8 Years
Discussion Span
Last Post by pirbhat.ariya
0

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

0

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

0

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.

0

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.

0

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.