P
Paulo da Silva
Please consider the following fragment:
using namespace std;
class C1
{ public:
bool operator == (C1 const &s)
{ return false;
}
};
class C2
{ private:
C1 c;
public:
bool comp(C2 const * s) const
{ return this->c==s->c;
}
};
I got the following error
"passing ‘const C1’ as ‘this’ argument of ‘bool C1:
perator==(const
C1&)’ discards qualifiers"
at line "{ return this->c==s->c;".
Is there any way to fix the problem acting on operator == definition, or
in the class C1?
Thanks.
using namespace std;
class C1
{ public:
bool operator == (C1 const &s)
{ return false;
}
};
class C2
{ private:
C1 c;
public:
bool comp(C2 const * s) const
{ return this->c==s->c;
}
};
I got the following error
"passing ‘const C1’ as ‘this’ argument of ‘bool C1:
C1&)’ discards qualifiers"
at line "{ return this->c==s->c;".
Is there any way to fix the problem acting on operator == definition, or
in the class C1?
Thanks.