Trying to understand inheritance. The PartTimeEmployee class should inherit attributes from the Employee class. But I get errors trying "tap" into the ReturnName method to print out the PartTimeEmployee information.
class Employee(object):
def __init__(self, employee_name):
self.employee_name = employee_name
def ReturnName(self, employee_name):
self.employee_name = employee_name
return 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
ft_emp = Employee("Mike")
ft_emp_name = ft_emp.ReturnName("Mike")
pt_emp = PartTimeEmployee("Bill")
#pt_emp_name = pt_emp.ReturnName("Bill")
ft_pay = ft_emp.calculate_wage(40)
#pt_pay = pt_emp_name.calculate_wage(20)
print "Full time employee %s made $%d for the week." %(ft_emp_name, ft_pay)
#print "Part time employee %s made $%d for the week." %(pt_emp_name, pt_pay)
>>>
Full time employee Mike made $800 for the week.
wagean attribute