C++ Update Object attributes using set function
This question already has an answer here:
You need to pass booklist
by reference:
void UpdateOnIsbn(vector <CBooks>& booklist)
Otherwise the vector is copied and only this copy is modified.
You are passing a copy of booklist
so you are modifying the copy not the original object.
Try passing a reference to the function void UpdateOnIsbn(vector <CBooks>& booklist)
上一篇: 何时将引用用作C ++中的参数
下一篇: 使用set函数的C ++更新对象属性