1>c:\users\lauren\documents\visual studio 2010\projects\mybankingsystem\mybankingsystem\main.cpp(42): error C2039: 'DeleteAccount' : is not a member of 'BankingSystem'
1> c:\users\lauren\documents\visual studio 2010\projects\mybankingsystem\mybankingsystem\bankingsystem.h(15) : see declaration of 'BankingSystem'
1>c:\users\lauren\documents\visual studio 2010\projects\mybankingsystem\mybankingsystem\main.cpp(45): error C2039: 'listAccount' : is not a member of 'BankingSystem'
1> c:\users\lauren\documents\visual studio 2010\projects\mybankingsystem\mybankingsystem\bankingsystem.h(15) : see declaration of 'BankingSystem
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
case 2: // erase existing account
void BankingSystem::DeleteAccount(string accountNumber)
for (int i=0; i < accounts_.size(); i++)
if (accounts_[i].getaccountNumber() == accountNumber)
void DeleteAccount(string accountNumber);
the DeleteAccount function is being defined in the global namespace, and is expecting a string. myBankingSystem->DeleteAccount(deleteAccount()); will call DeleteAccount using the string returned from deleteAccount. Also you have two DeleteAccount functions, one is in the BankingSystem namespace and the other is in the global namespace...
Just out of curiosity, why are you passing an account number as a string? Shouldn't that just be an int, or something...numerical?
The string accountName was someone else's idea and instead of changing the program, we just left it. Everything is working now, however. It was an issue with MSVC++'s compiler. We're still not sure what it was, but the restart didn't resolve it, renaming the functions didn't resolve it, but eventually a copy paste that broke the compiler right fixed it.
As for void DeleteAccount(string accountNumber);, it resided within the definition of the BankingSystem class but was taken out of context and looked ill placed. The function names weren't named very well, but we worked with what we had.
The code has been basically completed and is running correctly. There is a lot left out of it since it was a basic program for a class.
I still, for the life of, could not figure out why MSVC++ kept throwing the error it was when in the same file we had another member method defined the same way but with a different name, in main.cpp we had called that other method the same way we called DeleteAccount, but it only threw an error for DeleteAccount not being a member.