Hi all,
I have a question about operator overloading. Suppose we have defined a overloaded operator as so...
Can't we potentially define the != overloaded operator as:Code:// Implementing class TListIterator < T > template <typename T> int TListIterator<T>::operator == (const TListIterator<T>& I2) const { if (currLink == I2.currLink) return 1; return 0; }
...since logically they both are direct opposites of each other? Thanks.Code:template <typename T> int TListIterator<T>::operator != (const TListIterator<T>& I2) const { if(!operator==(I2)) return 1; return 0; }