Friday, 25 November 2016

C++ operator== overloading

Answer





Possible Duplicate:
Operator overloading






What is the differences between the following ways to overload operator== ?



// stroustrup way
friend bool operator== (MyClass &lhs, MyClass &rhs);



and



// as taught in other places, including caltech
bool MyClass::operator== (MyClass &rhs);


Which way is better?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...