Skip to content

Instantly share code, notes, and snippets.

@ooade
Created September 5, 2016 09:46
Show Gist options
  • Select an option

  • Save ooade/900fdb112d09d1b9bf4b477f85ac5a30 to your computer and use it in GitHub Desktop.

Select an option

Save ooade/900fdb112d09d1b9bf4b477f85ac5a30 to your computer and use it in GitHub Desktop.
Class Inheritance and Overriding
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("Marhyorh")
print milton.full_time_wage(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment