Unary and Binary Operator

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

Questions by Kamande Joseph

Showing Answers 1 - 7 of 7 Answers

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.++,--,==

  Was this answer useful?  Yes

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



  Was this answer useful?  Yes

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(<,>,>=,=,!=)..

  Was this answer useful?  Yes

Give your answer:

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

 

Related Answered Questions

 

Related Open Questions