Created
January 13, 2018 11:49
-
-
Save saraswatmks/106207c37c21069fae27b12f155e1c0b to your computer and use it in GitHub Desktop.
Derived class from Base Class inheriting same methods - Python
This file contains 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.00 | |
def full_time_wage(self, hours): | |
return super(PartTimeEmployee, self).calculate_wage(hours) | |
milton = PartTimeEmployee('Milton') | |
print milton.full_time_wage(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment