I am a beginner of C++.
Now I am going to write a inheritance program.
The following is the introduction of my program.
a. Implement the class "Employ" that have:
¡P protected data members name and salary which store the name of Employs and monthly salary;
¡P getName() retrieves the name of employs.
¡P calculateSalary() retrieves the salary.
b. Implement the Derive subclasses "Full-time" and ¡§Part-time¡¨. The calculateSalary() will calculate salary based on the following rules. printAll() function prints all information.
¡P For the Full-time employee, data member year stores the number of year the employ worked. If the year is > 15 years, then the salary would be increased by 20%, if the year is <= 15 years, then the salary would be increased by 10%.
¡P For the part-time employ, data member hourlyPay stores the hourly salary and hours store the number of hour the employ worked. The formula for calculateSalary() is ¡§salary =base-salary +hours * hourlyPay¡¨.
I want my program include 7 files.
1.main.cpp (I have attached it)
Employ.h as following
And I am writing the Employ.cpp.
But I don't know how to write the function of "getName", as it is use char pointer with it.
Can anyone help me solve this question?
Thanks a lot~