I try to change an object using an iterator, but I get this Error:
Error 1 error C2662: 'void Item::setCount(int)' : cannot convert 'this' pointer from 'const Item' to 'Item &'
1 IntelliSense: the object has type qualifiers that are not compatible with the member function
This is my code:
void Customer::addItem(Item other)//add item to the set
{
set<Item>::iterator it;
it = _items.find(other);
if (it != _items.end())
{
it->setCount( (this->getCount((*it)) + 1) );
}
else
_items.insert(other);
}
And in this line I have error:
it->setCount( (this->getCount((*it)) + 1) );