14 Explanation Please?



In the "return super(etc. etc. etc.)" part, why must 'hours' be the argument after .calculate_wage(hours)? I really just don't understand what's going on in that line...

Could someone walk me through the logic behind it?

class PartTimeEmployee(Employee):
    def calculate_wage(self, hours):
        self.hours = hours
        return hours * 12.00
    def full_time_wage(self, hours):
        return super(PartTimeEmployee, self).calculate_wage(hours)
milton = PartTimeEmployee("Milton")
print milton.full_time_wage(10)


The method takes one parameter, hours. The sub-class method overrides the super class method, but the method 'full_time_wage()reverts to the supercalculate_wage()` method.

Milton would normally be paid a part-time wage, but in this instance he is being paid a full-time wage for 10 hours work.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.