Hi, I'm trying to update an objects information within my linked list but for some reason after attempting to alter the data no changes appear to have taken place. As far as I am aware I'm not updating a copy of the object because I am finding the relevant object (and this does work) and then creating a pointer to the address of the found object and then updating it's contents. The exact same code works if I use a vector but not when I use my own linked list (which I need to implement because this is for an imporatant assignment).
bool Bank::withdraw(double amount, int index)
{
Account *a = &theAccounts.at(index);
if(a->getBalance() >= amount)
{
a->withdraw(amount);//problem is here
return true;
}
else
return false;
}
Above is the code that should be withdrawing money from an account but when I check the data after this method is called it displays it's original value (before withdrawal). Debugging showed me that the calculations etc. were all performed which is why I feel that somehow I am still only updating a copy.
I've attached my linked list files and also the bank files. Any help is greatly appreciated, I have an assignment deadline very soon :s