Afficher un message
Vieux 07/12/2007, 07h08   #4
David Harmon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: A question about operator overloading?

On Thu, 6 Dec 2007 07:00:20 -0800 (PST) in comp.lang.c++, dolphin
<jdxyw2004@gmail.com> wrote,
>Why the operator-() should not be a member function? Can someone give
>a example?


#include <complex>
int main()
{
std::complex<double> v(0.5);
v - 1.0; // works whether or not - is a member
1.0 - v; // Works only if - is a non-member.
}
  Réponse avec citation
 
Page generated in 0,04247 seconds with 9 queries