I am making a bank account program for a project. It contains a class for an account which stores the balance of the account and other things such as account number, interest rate etc. I am also required to have a transaction class that deals with withdrawals and deposits.
I have a function in my Account class which returns the balance of an account as the actual balance variable is private so it cannot be directly changed.
I have been working on this project most of the day so it might be a silly little error but basically i get the error 'error C2106: '=' : left operand must be l-value' at compilation from this code in my Transaction class:
You can't increment a function's return value (and even if you could, it'd be pretty pointless). You should make Account::balance public and instead do theAcc.balance+=amount;