Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

class EmployeeTemplate private: class OnLeaveEmployee EmployeeTemplate f protect

ID: 3758303 • Letter: C

Question

class EmployeeTemplate private: class OnLeaveEmployee EmployeeTemplate f protected: int emp daysOnLeave: string emp reasonForLeave: bool emp_onLeave; int emp_id; protected: public: JobPlacement emp-job; string emp_firstName; string emp_lastName; OnLeaveEmployee (string fname, string lname, string reason) EmployeeTemplate(fname, lname) emp onLeave true; emp-dayson Leave 0; emp_reasonForLeave = reason; public: EmploveeTemplate(string fname, string lname) virtual void updateLeave() emp_daysOnLeave++; virtual void endLeave() { emp-on Leave = false; } virtual void assignJob (JobPlacement j) emp idglobal id counter global_id counter++; emp-job Unassigned; emp firstName fname; throw new exception("Cannot assign a job to someone on leave!"); virtual string toString() return to_string (getId()) + ": "+ emp firstName+"" emp_lastName "In" "Status: ON LEAVE " "Days: "+ to_string(emp_daysOnLeave) "In" + "Reasonemp_reasonForLeave "In"; emp_lastName lname; -EmployeeTemplate() 1; int getId) f return emp id: JobPlacement getAssignment() f return emp_job; ) Important Note: enum JobPlacement virtual void assignJob(JobPlacement j) = ; virtual string toString() ; Unassigned, Accounting, Business, Engineer ing 1;

Explanation / Answer

1. d. assignJob needs to be implemented in some derived class

2. c. even empty function won't break the code but it needs to be at least defined

3. c. the code will be interrrupted and cause a crash because not all objects implement "assignJob"

4. d. This code works for any EmployeeTemplate object and it parents

5. b. As long as t is not NULL, this works fine