CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2008
    Posts
    13

    "operator" like in C++?

    Hi! I need to rewrite this from C++ to C#

    Code:
         FORCEINLINE bool operator == (const edge2f &other) const 
        {
    		return (_vids[0] == other._vids[0] && _vids[1] == other._vids[1]);
         }
    FORCEINLINE - I can ignore this, but is there some representation of "operator" in C#?

    As I understand, this part of code hooks up somewhere into if...else comparison, and does extra check as defined, if comparison operator == is used. Is there some equivavent of this in C#?


    Or in C#, I need to define custom function like

    bool ExtraCheck(const edge2f &other)
    {
    return (_vids[0] == other._vids[0] && _vids[1] == other._vids[1]);
    }

    and use it like this all the time?

    if (ExtraCheck(edge,_vids));

    I hope I can write some clean solution as we can in C++;

    It can also be operator +, += and e.t.c

  2. #2
    Join Date
    Jul 2008
    Posts
    13

    Re: "operator" like in C++?

    Please ignore this question, I've got answer already in other topic, it is called "operator overloading";

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