Re: strangely operator> overload
devphylosoff wrote:
ok, for one argument all is fine:
for 'friend', 'virtual' and normal function definig
What book are you reading that doesn't explain member vs. non-member
operator overloading?
i try to execute example from my Ph.d lecture.
You gave the lecture? You listened to the lecture?
You still didn't answer what book you were reading. None?
there was:
------
class Integer{
virtual bool operator>(const Integer& a, const Integer& b) = 0;
That's not C++. A member operator> shall have only one explicit
argument.
};
------
moreover, someone wrote:
In C++, these two functions are equivalent:
bool Pair::operator>(const Pair&) // C++ style
bool operator>(const Pair&, const Pair&) // C style
Nothing "C" in the latter. Where did you see this comment?
In the first one, the left argument gets passed implicitly as the
object (this), and in the second one both arguments are passed
explicitly.
That's true.
moreover:
you can find many examples in google/codesearch
for "bool operator<(const Class & ref1, const Class $ ref2) - with 2
arguments !
OK, any of those actually member functions?
what's wrong in my mind ? :>
I don't know the answer to this very generic question.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask