Unary and Binary Operator

Explain the concept of unary and binary operator overloading giving suitable examples.

Showing Answers 1 - 3 of 3 Answers

balasubramaniyank Profile Answers by balasubramaniyank

• Jul 19th, 2011

Unary operator is used to operate two operands. ex +,-,*. Mostly there are will be used only for Arithmatic operations.

Binary operators are used to operate the single operand values ex.++,--,==

angel421 Profile Answers by angel421

• Sep 9th, 2011

Please guys, check your answer before, I saw many of them wrong on this website. The above "binary operators" description should say this: (++ and -- are Unary by the way....)

The binary operators are categorized as follows:

Multiplicative operators: multiplication (*), remainder (%), and division (/)
Additive operators: addition (+) and subtraction (-)
Shift operators: left shift (<<) and right shift (>>)
Relational operators: less than (<), less than or equal to (<=), greater than (>), and greater than or equal to (>=)
Equality operators: equality (==) and inequality (!=)
Bitwise operators: AND (&), OR (|), and XOR (^)
Logical operators: AND (&&) and OR (||)

or even better:

http://msdn.microsoft.com/en-us/library/czs2584d.aspx

manjit kaur

• Sep 11th, 2012

unary operator takes a single operand..exampleof (incerement ++ and decrement -- operators).unary also classified as
1.simple prefix unary operator ,example the (-)minusoperator
2.pre and post increment and decrement operator...

and

binary operators are work with two operands.....
example of binary operators,the arithmatic operators(+,-,*,/,%),arithmatic assignment operator(+=,-=,*=,/=,%=) and comparision operators(<,>,>=,=,!=)..

If you think the above answer is not correct, Please select a reason and add your answer below.