Hello, everyone. I'm having a hard time trying to figure out how to declare and initialize my dynamic array of objects. Here is the class definition and constructor definition:
class SavingsAccount : public BankAccount {
public:
SavingsAccount(char, int, string, double, int, double=2.00, double=0.0, double=0.0);
double getinterestR() const;
double getaverageDailyBalance() const;
double getinterestYtd() const;
void setinterestR(double);
void endOfDay();
void print() const;
private:
double interestR;
double averageDailyBalance;
double interestYtd;
int daysTotal;
void setaverageDailyBalance(double);
void setinterestYtd(double);
void interestCalc();
};
//
SavingsAccount::SavingsAccount(char type, int numID, string name, double bal, int days, double interest, double adb, double iytd) : BankAccount(type, numID, name, bal, days)
{
setinterestR(interest);
setaverageDailyBalance(adb);
setinterestYtd(iytd);
}
I tried to do this in main():
SavingsAccount *accounts;
accounts = new SavingsAccount [100];
I get the compilation error: "error: no matching function for call to 'SavingsAccount::SavingsAccount()'"
I thought I needed to add a constructor with no parameters but that didn't work or I didn't do it right.
Any help will be greatly appreciated. Thanks!