How to define operator == () in class?

  • Try Google or a book on C ++ (any). This is the basic part of the language. - VladD

1 answer 1

class element { ... SomeType value; public: ... friend bool operator==(const element& left, const element& right); } ... bool operator==(const element& left, const element& right) { return left.value==right.value; } 

Like that.