0

:-/
Hey friends I have a problem regarding operator overloading concept in C# language,can
anyone among you please make me understand and supply some example of operator overloading
concept.Some codes can you guys please send me for better understanding and with a brief description..please.

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Geekitygeek
0

Hi there,

I suggest you to read first some tutorials and try to understand how it works. If you read through and you don't understand specific parts or have questions, post it here and I'm sure we can help you out :)

0

Here is a small exemple

public static bool operator ==( User user1, User2 user2 )
                {
                        return ( href1.Username == Href2.Username && href1.Id == href2.Id);
                }
0

The operators in C# have predefined behaviours when used against the certain types. When you define a custom type, you can also set the behaviour of these operators when applied to that type.

Theres a nice run down of which operators can be overloaded and some examples here.

Shout if you need anything in the link explained :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.