yyiu002
22nd June 2010, 00:22
Hi , I have a problem when compile following code:
for(int i=0;i<curConnections.size();++i)
{
if (curConnections.at(i).Descriptor()==connName)
{
curConnections.at(i).sendCmd(cmd);
break;
}
}
Compiler complains:
error: passing 'const ConnConnection' as 'this' argument of 'void ConnConnection::sendCmd(const QString&)' discards qualifiers
Then I use following it compiles OK.
curConnections[i].sendCmd(cmd);
I am not quite get what's the difference of these 2 lines of code.
for(int i=0;i<curConnections.size();++i)
{
if (curConnections.at(i).Descriptor()==connName)
{
curConnections.at(i).sendCmd(cmd);
break;
}
}
Compiler complains:
error: passing 'const ConnConnection' as 'this' argument of 'void ConnConnection::sendCmd(const QString&)' discards qualifiers
Then I use following it compiles OK.
curConnections[i].sendCmd(cmd);
I am not quite get what's the difference of these 2 lines of code.