Hello. First, here is my code:
class BankAccount
{
private:
int accountNum;
double balance;
public:
bool setAccountNum(int num);
int getAccountNum() const;
double getBalance() const;
void depositMoney(double money);
bool withdrawMoney(double money);
void displayAccount() const;
BankAccount();
};
class SavingsAccount: public BankAccount
{
private:
int accountNum;
double sBalance, rate;
public:
void setInterest(double rates);
double showInterest() const;
void postInterest();
void displayAccount() const;
SavingsAccount();
};
class CheckingAccount: public BankAccount
{
private:
int accountNum;
double balance, rate, MinBal, sCharge;
public:
void setInterest(double rates);
void setMinBal(double bal);
void setServiceCharge(double amount);
double showServiceCharge() const;
bool serviceCharge();
double showInterest() const;
double showMinBal() const;
void postInterest();
bool writeCheck(double amount);
void displayAccount() const;
CheckingAccount();
};
Above is prototyping for the classes. Now, the classes can modify member variables besides the accountNum and balance just fine. However, when I try to directly modify the balance of either the Checking or Savings class using member functions respective to those two classes, it won't let me; I can only modify the balance variable using the base class functions. Why is that?