Which is best practice (in this case):
bool Foo::operator==(const Foo& other) {
return bar == other.bar;
}
// Implementation 1
bool Foo::operator!=(co
In general, implementation 2 is better for many reasons. First of all, you don't write (almost) duplicate code. If you need to change it (because the class has grown or there has been a bug), again with implementation 2 you change only 1 place. That is, implementation 2 makes your code more consistent and less error prone.