OK
1 2 3 4 5 6 7 8 9 10 11 12 13
|
private:
string _accountNumber;
string _passCode;
string _lastName;
string _firstName;
double _balance;
double _startBalance;
public:
string lastName;
string firstName;
double balance;
string accountNumber;
double startBalance;
|
Now you have you variables twice (though with slightly different names), and you also have them again in main().
You really only need them once as private variables - that is the purpose of have get and set functions.
The idea is to have all the variables and functions private (they can be accessed directly by the functions in the account class. Then you have public get functions to access the variables (only the ones you need) from the object (myAccount). The same applies to set functions.
Obviously you are not going to have public getPassCode or setPassCode functions. The same applies for the other variables.
Think about the real life situation. You wouldn't want anyone to go to your bank and be able to change the account name, number, balance, pass code etc for your bank account. Say you wish to change your passcode. So the bank verifies that it is you ( they have a procedure) the change is done via a ChangePassCode function not by directly changing the PassCode variable. Same thing with account balance, this is done via Deposit and Withdrawal functions,with appropriate verification.
I hope this explains some of the ideas better.
I know it's a bit of a pain, but I would seriously recommend crating the Account.cpp file.