我正在 Codedemy 上上 Python 课程。我在他们教授课程和面向对象编程的部分。我正在为继承而苦苦挣扎。尝试覆盖父母方法时收到此错误消息:
<bound method PartTimeEmployee.full_time_wage of <__main__.PartTimeEmployee object>>
在这段代码中:
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
class PartTimeEmployee(Employee):
def calculate_wage(self, hours):
self.hours = hours
return hours * 12.00
def full_time_wage(self):
super(PartTimeEmployee, self).calculate_wage(self, hours)
milton = PartTimeEmployee("Milton")
print milton.full_time_wage
那么问题是什么?