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

1. you should write down explanation for every line of the code. 2. you should e

ID: 3574380 • Letter: 1

Question

1. you should write down explanation for every line of the code.

2. you should explain about the example code. explanation for following contents should be included in this part.

- the inheritance structure of the Employee class

- mechanism of polymorphism in Employee class (explain with handle and virtual function)

- definition of dynamic binding and static binding

- the implementation mechanism and effect of polymorphism using vector

Our Employee E Taa Hourly Employe 1 Fig. 13.17: HourlyEmployee.h 2 HourlyEmployee class definition. 3 #ifndef HOURLY H 4 #define HOURLY H 6 #include Employee.h" Employee class definition 8 class HourlyEmployee public Employee Hourly Employee inherits from Employee must override earnings to be concrete 10 public 11 Hourly Employee C const string &, const string & const string &, double 0.0, double 0.0 12 13 14 void setwage C double set hourly wage 15 double getwageo const return hourly wage 16 17 void set Hours( double set hours worked 18 double getHours C) Const return hours worked 19 20 keyword virtual signals intent to override 21 virtual double earnings O const calculate earnings 22 virtual void print O const prin HourlyEmployee object 23 private 24 double wage wage per hour 25 double hours hours worked for week Functions will be overridden 26 h; end class HourlyEmployee (or defined for first time) 28 #endif HOURLY H

Explanation / Answer

HourlyEmployee.h

Line 8 : Defines a class HourlyEmployee which inherits Employee class

Line 14 to : Declares and defines setter & getter for attributes

HourlyEmployee.cpp

Line 9 to 15 : Instatiates an object of class HourlyEmployee and calls setters to set the attribute values

Line 18 to 59 : Defines the methods declared in HourlyEmployee class.