As far as I understand the "const" argument modifier means the argument ("c" in this case will not be modified by the function/method. But the compiler, Qt4.6, is not helping me. It says:
error: passing 'const Constraint' as 'this' argument of 'VirtualConnection& Constraint::Virtual()' discards qualifiers
on every line of the _if_ inside _operator==_ overload method.
can someone give me a lead?, or understand the error?
The other alternative is make the Constraint object non-const - but that will incur a copying penalty; bool Constraint::operator==( Constraint& c)
This isn't quite right either;
1 2 3 4 5 6 7
Constraint& operator= (const Constraint& c)
{
this->_pconn->Set( c.Physical() );
this->_vconn->Set( c.Virtual() );
this->_type = c.Type();
returnthis; //Error this is a pointer not an object - change to - return *this.
}