Question: Write main function to answer the following questions. Only submit the main function for this problem. i. Create an Employee object using the constructor with
Write main function to answer the following questions. Only submit the main function for this problem.
i. Create an Employee object using the constructor with parameters. [2pts]
ii. Declare an Employee pointer and make it point to the Employee object created in part (i). [2pts]
iii. Use the pointer to call the print() method of the object. [2pts]
iv. Dynamically create an Employee object using the constructor with parameters and make the Employee pointer point to this newly created dynamic object. [4pts]
v. Use the pointer to set the name of the Employee to some other name. [2pts]
vi. Use the pointer to call the print function. [2pts]
vii. Use the pointer to allocate a dynamic array of three employees and populate the array with Employee objects. What happens to the previously allocated memory for the Employee in part (iv)? [2pts]
viii. Use a for loop to print the Employees objects in the dynamic array constructed in part (vii). [2pts]
ix. Delete the pointer and set it to point to NULL. Explain what does this step do? [2pts]
Step by Step Solution
There are 3 Steps involved in it
Certainly heres the main function that addresses the questions youve mentioned include include class ... View full answer
Get step-by-step solutions from verified subject matter experts
