On Sep 1, 8:10*pm, "Hicham Mouline" <hic...@mouline.org> wrote:
> Hello,
>
> struct S {
> * double d1;
> *double d2;
>
> };
>
> S s1,s2;
>
> what was the reason that
>
> s1=s2; *// assignment operator (default defined for PODs, right?)
>
> was valid, but not
>
> if (s1 == s2) *// test for equality
>
> Regards,
Hi Hicham
Because the first one is copy assignment operator, but the second one
is equality operator.
The first one is declared and defined by compiler implicitly with
default behavior,
but in equality operator case , you have to declare and define its
behavior explicitly.
Regards,
-- Saeed Amrollahi
|