Need a new set of eyes for this .

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
Main.cpp
case 2: // erase existing account
           myBankingSystem->DeleteAccount(deleteAccount());
            break;
BankingSystem.cpp
void BankingSystem::DeleteAccount(string accountNumber) 
{
	for (int i=0; i < accounts_.size(); i++)
{
if (accounts_[i].getaccountNumber() == accountNumber)
{
accounts_.erase(accounts_.begin()+i);
	break;
}
	}
}
BankingSystem.h
void DeleteAccount(string accountNumber);

Line 3) You're invoking DeleteAccount as a fnunction that is a member of a class, but your declaration at line 18 shows a global function, not a member of a class.

Line 3) Is deleteAccount() (little d big A) a function that returns a string?
DeleteAccount (big D, big A) is expecting a string.

deleteAccount() returns a string and is a local function
DeleteAccount(string) accepts a string and is a member of BankingSystem
Line 18 is the declaration of the member function
I have a copy of all files and received no such error. Several warnings about uninitialized members, but nothing regarding DeleteAccount not being a member. I'm chalking this one up to MSVC++ sucking.

Ran with g++ 4.7.1
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.
Topic archived. No new replies allowed.