OK, apparently I need to break down my post.
A comma signals a pause, so let's try to grasp what needs to be comprehended. Let's make a program to compare my two dogs. We create the Dog class and make two objects:
Code:
Dog freckles("Freckles");
Dog tula("Tula");
// freckles = tula;
if ( freckles == tula ) {
cout << "They are the same\n";
}
else {
cout << "They are different\n";
}
If and only if the commented line is executed would you get the "same" result. So this exemplifies what it means to make two distinct pre-existing objects compare equally.
Now, since operator== is also overloadable, you cannot trust the if condition unless operator== is working as it should. You could make a fundamental mistake, like add a member to the Dog object and not change the comparison operator, and it would result in some objects comparing alike that are not. Or even "stupider" than that, similar to how you can implement plus to
be minus.
To understand this part of my post, I think the only difference is the definitions of pre-existing and new. Specifically, a new object doesn't pre-exist, you are making it. The caveat about equality still applies, but I need not repeat myself.