14 Explanation Please?


#1



https://www.codecademy.com/en/courses/python-intermediate-en-WL8e4/2/4?curriculum_id=4f89dab3d788890003000096


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)


#2

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.


#3

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