Hello. I'm on my second day of c++ and I'm already stuck. Forgive me if I keep this brief - I just spent 10 minutes writing out my problem, then I hit the back button and lost it all!
The error I am getting is...
error: 'getBalance' undeclared (first use this function)
I wanted to use the getBalance() function in the debit fuction but got this error. But I noticed that the setBalance() function in the contructor didn't cause an error. So I moved the getBalance()function into the contructor and it didn't cause an error there. If I move the setBalance function to either the debit or credit function it DOES cause an error. I don't understand what's going on.
Can anyone help? I've got a feeling I'm missing an obvious type but I can't see it.
The header file
1 2 3 4 5 6 7 8 9 10 11
class Account {
public:
Account(int);
void setBalance(int);
int getBalance();
void credit(int);
void debit(int);
private:
int balance;
};
Here the getBalance() function is in the debit() function and causes the error.