When defining the equality operator,
class foo
{
bool operator ==(const foo& other) const; //explicit
}
why is the inequality operator not implicitly defined unless another is explicitly defined. By default
"a == b" <==> "!(a != b)"
and the following definition can be used
bool operator !=(const foo& other) const
{
return !(this->operator==(other));
}
But why should does this definition need to be added every time?