I'm having a really difficult time in my current c++ class. I've exhausted myself for the last couple of days asking my professor for help, and maybe he doesn't get what I'm asking. I can't find any resources online.
Basically my issue is my program this week has to cin to a variable, we have to take that variable and tuck it into a class as a private variable, and then be able to change, and access the variable again.
the program is a mess and i'm confused on a lot of other stuff too, but this is the first.
this is the section in main I have to use (was provided by class)
there is a lot of other stuff going on around this but this is where im starting, because i really have no clue where to start and i've been asking the prof for help all week.
1 2 3 4 5 6 7
|
#include SavingsAccount.h
SavingsAccount account2;
cout << "Set savings account interest rate" << endl;
cin >> newInterestRate;
account2.setInterestRate(newInterestRate);
|
so to do this in the class header file i have this (again, amongst other stuff i have trimmed for clarity)
1 2 3 4 5 6 7 8 9 10 11 12 13
|
class SavingsAccount: public BankAccount
{
public:
void setInterestRate(double newInterestRate)
{
interestRate = newInterestRate;
};
double getInterestRate()
{
return interestRate;
} ;
private:
double interestRate(double newInterestRate);
|
I use the assignment operator above in setInterestRate and it tells me interestRate must be a 'modifiable lvalue'
my professor keeps pointing me to bucky's c++ tutorials on youtube but the one referencing this (13) has only done me more harm. someone point me in the right direction?
I pretty much missed last week while i was on vacation so i'm playing catch up and really regretting going on vacation.