I'm having some trouble attempting to implement the constructors for each class.
I have this constructor for the class Transaction. Is this correct ?
Transaction::Transaction(QString type, QDateTime datetime) : m_Type(type), m_DateTime(datetime)
{ }
AND how do i implement the constructor for the class Deposit ?
Is this correct ? I'm getting the following error (refer to attachment)
Deposit::Deposit(double amount) : Transaction(type,datetime)
{ }
Any help will be appreciated to get me going.
Thanks
Reggie
#ifndef Q1_H
#define Q1_H
class Transaction{
public:
Transaction(QString type, QDateTime datetime);
QString getType() const;
QString toString() const;
QDateTime getDateTime() const;
virtual double computeCost() = 0;
protected:
QString m_Type;
QDateTime m_DateTime;
};
class Deposit : public Transaction{
public:
Deposit(double amount);
QString toString() const;
double computeCost();
private:
double m_Amount;
static double m_Fee;
};
class Withdrawal : public Transaction{
public:
Withdrawal(double amount);
QString toString() const;
double computeCost();
private:
double m_Amount;
double m_Percentage;
};
class BalanceEnquiry : public Transaction{
public:
BalanceEnquiry(QDate fDate, QDate tDate);
QString toString() const;
double computeCost();
private:
QDate m_FromDate;
QDate m_ToDate;
};
class SavingsAccount{
public:
SavingsAccount(QString name, QString num);
~SavingsAccount();
void addTransaction(Transaction* t);
double totalTransactionCost();
QString frequentTransactionType() const;
QList<Transaction*> transactionsOnADate(QDate date);
QString toString() const;
private:
QString m_CustomerName;
QString m_AccountNumber;
QList<Transaction*> m_TransactionList;
};
#endif // Q1_H