Created
September 5, 2016 09:46
-
-
Save ooade/900fdb112d09d1b9bf4b477f85ac5a30 to your computer and use it in GitHub Desktop.
Class Inheritance and Overriding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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