CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2000
    Posts
    1,471

    What is the difference between == and Equals?

    Any ideas would be appreciated.

  2. #2
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    129
    Well.. there isnt any difference actually... its just its relly easy to use == instead of Function.Equals

    Thats it!
    Regards,
    Alexei

  3. #3
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,754
    Quote Originally Posted by Alexei Kubarev
    Well.. there isnt any difference actually... its just its relly easy to use == instead of Function.Equals

    Thats it!

    Being smart....

    one is an operator and one is a method........

  4. #4
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940
    To expand on what Brad has said :

    I believe (and Brad can confirm) the 'Equals' is an overrided function which is used by the operator '==' when necessary.

    So one is an operator and the other is a method, but the operator uses the method internally to determine the result.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  5. #5
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    129

    Unhappy

    Ehh... okej... i admit that it wasnt the smartes answer...

    Hehe... But it still works if you write Function.Equals == somevalue..

    I think :S not really sure about that... :S
    Regards,
    Alexei

  6. #6
    Join Date
    Jul 2004
    Location
    Lahore
    Posts
    27
    Yes I agree that Equals is an overriden function and == operator calls it.

    Actually the equals provide general view as equals is defined in object class and the overriding classes provide their own functionality for this function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured