I have been for many years to Java's = = and equals the difference and contact is not clear, later made clear, note here:
Http://www.cnblogs.com/findumars/p/3240761.html
Http://www.cnblogs.com/findumars/p/3746878.html
To dig out more details, in fact, just understand a principle: two objects in memory is two different areas, even if all its content exactly the same, it is still two different objects. Programming is just a description of logic, in some cases we have to define what is called two objects equal. This is up to you, you can define the first address of two objects equal to the equality of objects (in fact, it is impossible to achieve), you can define their hashcode equality is equal to the object, or only the object name is equal even if the object is equal. This idea is common in oo and is not only unique to Java. For example, this description is found in the QT documentation today:
bool Qvector::contains (const T &
value ) const
Returns true if the vector contains an occurrence of value; otherwise returns false.
This function requires the value type to has an implementation of operator== ().
Is that qvector don't understand what you mean by inclusion. So you have to define the = = operator separately for data of type T. I think, compare two objects equal enough trouble, unless the logic really needs to save and manipulate the object directly, otherwise, as long as the comparison of two objects of the pointer (the first address) can be. that would be easier. Just like the Tlist in Delphi, the core management class of RTL, many RTL classes are implemented by it, but tlist is not usually just for holding pointers (but it happens to be All tobject.create returns are pointers on the heap, which can be cumbersome if the object is saved directly.
Two C + + objects, such as the programmer's own definition, usually the override = = operator