Hi Dudes
can any one help me that why use operator overloading in what is the real use of operator overloading.....?
and
Operator Overloading should return a CLS type and not void. // what is CLS here
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandeep ShekhawatPosted Jul 5, 2011, 8:16 AM
1.Complie Time: It has also two type (i)Method Overloading (ii)Operator Overload
2.Run Time:It has onle one type(i)Method Overriding
So operator overloading is part of Ploymorphism. If u want description this with example then Read
http://www.c-sharpcorner.com/UploadFile/prvn_131971/OverloadingCsharp11222009225324PM/OverloadingCsharp.aspx
http://www.c-sharpcorner.com/UploadFile/6897bc/3952/
http://www.c-sharpcorner.com/UploadFile/rajeshvs/OperatorOverloading11112005022230AM/OperatorOverloading.aspx
http://www.c-sharpcorner.com/UploadFile/prasadh/OperatorOverloading11142005003229AM/OperatorOverloading.aspx
http://www.c-sharpcorner.com/UploadFile/prasad_1/OperatorOverloadingSample11172005042233AM/OperatorOverloadingSample.aspx
But Remember we can not overload all Opertor.
Jaganathan BantheswaranPosted Jul 5, 2011, 8:14 AM
This is what in my mind.. Just for imagination... Before this, You should know what is Operator Overloading...
Consider,
You are having two classes say A & B with two integer variable.
Now you need to add the integer values from Class A with Class B.
Probably you will do like this,
A a = new A();
B b = new B();
int result = a.firstVar + b.firstVar;
...........
Instead of doing the abvoe, Using Operator overloading,
int result = a + b; // operator used to overload here is "+".
in overloaded function we will access the variables and will process.
Vilas GitePosted Jul 5, 2011, 8:08 AM
Please Refer good tutorials from: http://www.csharp-station.com/Tutorials/Lesson18.aspx
CLS: Common Language Specification http://msdn.microsoft.com/en-us/library/12a7a7h3(v=VS.71).aspx
----------------------------------------------------------------------------------------------------
If this reply hepls your post…then "MARK AS ANSWER"!