Answer:
See explanation
Step-by-step explanation:
i. employee tempEmployee;
Here an object of class is created. So when an object is created, the constructor is called. So
the line number containing the constructor that is executed in this declaration is:
employee ();
ii. employee newEmployee ("Harry Miller", 0, 2500);
This is the call to a parameterized constructor. Since it is passing three values to constructor so the constructor with three parameters is invoked here.
employee(string, int, double);
iii employee oldEmployee ("Bill Dunbar", 15, 55000);
This is the call to a parameterized constructor. Since it is passing three values to constructor so the constructor with three parameters is invoked here.
employee(string, int, double);
B. Write the definition of the constructor in Line 4 so that the instance variables are initialized to " ", 0, and 0.0 ,respectively.
employee::employee()
{
name = "";
numOfSerivceYears = 0
salary = 0.0;
}
C. Write the definition of the constructor in LIne 5 so that the instance variables are initialized according to the parameters.
employee::employee(string empName, int years, double sal) {
name = empName;
numOfSerivceYears = years;
salary = sal; }
D. Write the definition of the constructor in line 6 so that the insurance variable name is initialized to empty string and the remaining instance variables are initialized according to the parameters
employee::employee(int years, double sal) {
numOfServiceYears = years;
salary = sal; }