Say, i have a display() that display the name and particulars of a employee.
I have a base class Employee() and 2 derive class TempEmployee and ContractEmployee classes. How do i go about defining a
Calculation function that have this formula:
Ultimately, a function consist of three 'decisions':
-What input does it need? ("Parameters")
-What calculations does it need to do? ("Function body")
-What output does it provide? ("Return value")
Do you want Staf::display() to also print the gross pay?
You can output (or use in any other way) the return value of a function just like you would a variable of that type. cout << calculatePay(mPay, otHour, otRate) << endl; will output the value of calculatePay.