1

I am beginner in C++. I have a problem with compiling code.

AddEmployeeTransaction.h

extern PayrollDatabase GpayrollDatabase;

class AddEmployeeTransaction : public Transaction {
    public:
        virtual ~AddEmployeeTransaction();
        AddEmployeeTransaction(int empid, string name, string address);
        virtual PaymentClassification* GetClassification() const = 0;
        virtual PaymentSchedule* GetSchedule() const = 0;
        virtual void Execute();

    private:
        int itsEmpid;
        string itsName;
        string itsAddress;

};


#endif //PAYROLL_ADDEMPLOYEETRANSACTION_H

AddEmployeeTransaction.cpp

AddEmployeeTransaction::~AddEmployeeTransaction() {
}

AddEmployeeTransaction::
AddEmployeeTransaction(int empid, string name, string address)
        : itsEmpid(empid)
        , itsName(name)
        , itsAddress(address){}

PaymentClassification* AddEmployeeTransaction::GetClassification() const {}

PaymentSchedule* AddEmployeeTransaction::GetSchedule() const {}

void AddEmployeeTransaction::Execute() {
    PaymentClassification* pc = GetClassification();
    PaymentSchedule* ps = GetSchedule();
    PaymentMethod* pm = new HoldMethod();
    Employee* e = new Employee(itsEmpid, itsName, itsAddress);
    e->SetClassification(pc);
    e->SetSchedule(ps);
    e->SetMethod(pm);
    GpayrollDatabase.AddEmployee(itsEmpid, e);
}



#endif //PAYROLL_TRANSACTION_H

When compiling I got the error message : : undefined reference to `vtable for Transaction'

Ngo Lam
  • 31
  • 3

0 Answers0