I can not figure out how to fix this constructor. It keeps returning the error:"no matching function for call to 'JMTDSavingsAccount::JMTDSavingsAccount()' " This is weird because the error is on the constructor for the child class (child class: JMTDCheckingAccount, parent: JMTDSavingsAccount). Isn't the constructor not passed on to the child class?
Header for child class:
#define JMTDCHECKINGACCOUNT_H
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include "JMTDSavingsAccount.h"
class JMTDCheckingAccount : public JMTDSavingsAccount {
private:
double transaction_fee();
public:
JMTDCheckingAccount(double balance, std::string account_number, double transaction_fee);
void set_transaction_fee(double fee);
double get_transaction_fee();
virtual void deposit(double amount);
virtual void withdraw(double amount);
std::string a_to_string();
};
#endif
source file for child class: (only the part we are dealing with)
#include "JMTDCheckingAccount.h"
#include "JMTDSavingsAccount.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;
JMTDCheckingAccount::JMTDCheckingAccount(double b, string a_n, double t_f){
set_account_number(a_n);
set_transaction_fee(t_f);
set_balance(b);
}
And here is the parents header:
#ifndef JMTDSAVINGSACCOUNT_H
#define JMTDSAVINGSACCOUNT_H
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
class JMTDSavingsAccount {
private:
std::string account_number;
double balance;
public:
JMTDSavingsAccount(double balance, std::string account_number);
void set_balance(double b);
int get_balance() const;
void set_account_number(std::string a_n);
std::string get_account_number() const;
virtual void deposit(double amount);
virtual void withdraw(double amount);
virtual std::string a_to_string();
};
#endif
and finally the parent source file:
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include "JMTDSavingsAccount.h"
using namespace std;
JMTDSavingsAccount::JMTDSavingsAccount(double b, string a_n){
set_balance(b);
set_account_number(a_n);
}
void JMTDSavingsAccount::set_balance(double b){
balance = b;
}
int JMTDSavingsAccount::get_balance() const{
return balance;
}
void JMTDSavingsAccount::set_account_number(string a_n){
account_number = a_n;
}
string JMTDSavingsAccount::get_account_number() const{
return account_number;
}
void JMTDSavingsAccount::deposit(double amount){
set_balance(balance + amount);
}
void JMTDSavingsAccount::withdraw(double amount){
set_balance(balance - amount);
}
string JMTDSavingsAccount::a_to_string(){
}