Hi guys, In the programming assignment instructions I need to have my base class
ID: 3766704 • Letter: H
Question
Hi guys, In the programming assignment instructions I need to have my base class Employee create a "pure virtual member function" and i tried to do that like so,
#pragma once
#include <string>
using namespace std;
class Employee
{
public:
Employee();
~Employee();
Employee(int employeeID, string employeeName, string isWorking);
void setEmployeeID(int theEmployeeID);
void setemployeeName(string theEmployeeName);
void setIsWorking(string theIsWorking);
int getemployeeID();
string getemployeeName();
string getIsWorking();
virtual double getPay() = 0;
private:
int employeeID;
string employeeName;
string isWorking;
};
double Staff::getPay()
{
double biWeeklySalary;
biWeeklySalary = weeklySalary * 2;
return;
}
double Faculty::getPay()
{
double biWeeklySalary;
biWeeklySalary = (annualSalary / weeksPerYear) * 2;
return 0.0;
}
double StudentEmployee::getPay()
{
double biWeeklySalary;
biWeeklySalary = (2 * hoursWorked) * payRate;
return biWeeklySalary;
}
Im just trying to calculate the 2 week pay amount in faculty class, studentEmployee, and Staff class all inherit from Employee.
and then later on im gonna call this function in the display employee method along with their bi weekly pay.
is that correct way to "overwrite a pure virtual function"
Explanation / Answer
yes
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.