Operator overloading is also called redesigning the language. Please comment.

Showing Answers 1 - 5 of 5 Answers

ritik

  • Jul 15th, 2006
 

Operator Overloading can also be called as redesigning the language;any language validates certain set of operators ,which the user can use while coding ,these operators have predefined meaning in the respective language i.e the operators can operate only on a specific set of variables/constants.Languages with capability of operator overloading allow users to give a new meaning(additional) to the operators as  a result operators can also operate on user defined datatypes.

  Was this answer useful?  Yes

Avi

  • Aug 3rd, 2006
 

I Think Computer languages have certain set of operators ,which the user can use while coding ,these operators have predefined meaning in the respective language i.e the operators can operate only on a specific set of variables/constants.Languages with capability of operator overloading allow users to give a new meaning(additional) to the operators  Only not for the complete Language so if We say That with the help of operator overloading we can improve the power and domin area for a perticular operator but the language concept and design is remain same so we can say operator overloading is also called redesigning of operator functunality.

  Was this answer useful?  Yes

I do not agree with the statement.

It is true that with operator overloading, you can make an operator to behave in absurd manner, but still you have limitations.
Also, operator overloading feature has been provided, to BEHAVE your class objects, as close as possible, to Basic Data type.
i.e.
complexClass& complexClass::operator+(const complexClass& oCmplxObj)
{
...
}
is supposed to return addition of two complex numbers, instead of their multiplication or subtraction or division.

So, at max, you are REDESIGNING your class, nothing else.

  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