I am making a program that would be nice with it. Can someone give me an example and explain how it works? It would be so helpful, thank you ^^
3/13/2017 3:13:16 AM
Rain2 Answers
New AnswerOperator Overloading -------------------------------------------------------------------------------------------- - This helps in redefining operator with respect to the object - Almost all operators can overloaded except - ., ::, :, ?, -> <return-type> operator <sym> (parameter); For example please visit https://code.sololearn.com/cKpSHlLsr1Ih/#cpp
operator overloading is done to use one operator in a sense for which it was defined. eg. void operator + (obj a, obj b) { obj c; c.q=a.q+b.q; printf("addition of two objects : %d",c q); } here + was originally defined for adding two numerals, but here is redefined to add two objects.
Learn Playing. Play Learning
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message