This looks like a job for


#1



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


Hi,
My code is working perfectly fine. Just I have a doubt and I cannot interpret it properly.
The code takes calculate_wage(hours) from Employee class when we apply the "super" call. Why does it take from Employee class and not from PartTimeEmployee class?
When we call "super", we refer to PartTimeEmployee in the brackets.


Replace this line with your code. 

class Employee(object):
    """Models real-life employees!"""
    def __init__(self, employee_name):
        self.employee_name = employee_name

    def calculate_wage(self, hours):
        self.hours = hours
        return hours * 20.00

# Add your code below!
class PartTimeEmployee(Employee):
    def calculate_wage(self,hours):
        self.hours=hours
        return hours*12
        
    def full_time_wage(self,hours):
        return super(PartTimeEmployee,self).calculate_wage(hours)
        
milton= PartTimeEmployee("Peter")
print milton.full_time_wage(10)


#2

super() is designed to call parents method. So that is why calculate_wage of Employee is called


#3

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