【Python】python新手关于继承的练习代码

作者: IT派森 | 来源:发表于2019-08-13 15:08 被阅读3次

<python新手关于继承的练习代码>

  1. [python新手关于继承的练习代码代码][Python]代码
在学习过程中有什么不懂得可以加我的
python学习交流扣扣qun,784758214
群里有不错的学习视频教程、开发工具与电子书籍。
与你分享python企业当下人才需求及怎么从零基础学习好python,和学习什么内容
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("name")
print milton.full_time_wage(10)

相关文章

网友评论

    本文标题:【Python】python新手关于继承的练习代码

    本文链接:https://www.haomeiwen.com/subject/uoztcctx.html