Which of the following is true about the overloading of ‘+’ and ‘-‘ operators?

Which of the following is true about the overloading of ‘+’ and ‘-‘ operators?
A. They can be defined as binary operators only
B. They can be defined as unary operators only
C. They can be defined as ternary operators only
D. They can be defined as either binary or unary operators
 
Answer: d
Explanation: These are the two operators which can be defined as both binary as well as unary operators. Binary operators are those which take two operands and unary operators take a single operator. It is not possible to define them as ternary operators.
 

Tìm kiếm

Back
Top