?
=?ISO-8859-1?Q?Mattias_Br=E4ndstr=F6m?=
Hello!
I'm just curious as to what the group recommends when implementing
operator==? Should it be a member function or a free function. The
reason I might want to have it as free function is to get type
conversion on the left hand side argument.
class Decimal() {
public:
Decimal(std::string);
}
Decimal d("1.2");
d == "1";
"1" == d;
As fas as I understand this is the recomended way to implement the
arithmetic operators. Does the same arguments hold for operator==?
Regards,
Mattias
I'm just curious as to what the group recommends when implementing
operator==? Should it be a member function or a free function. The
reason I might want to have it as free function is to get type
conversion on the left hand side argument.
class Decimal() {
public:
Decimal(std::string);
}
Decimal d("1.2");
d == "1";
"1" == d;
As fas as I understand this is the recomended way to implement the
arithmetic operators. Does the same arguments hold for operator==?
Regards,
Mattias