美文网首页
Python 32 Programming Tutorial

Python 32 Programming Tutorial

作者: 豆表示低调 | 来源:发表于2016-08-31 11:41 被阅读0次
    class Parent():
    
        def print_last_name(self):
            print('Roberts')
    
        def print_skin_color(self):
            print('White')
    
    
    class Child(Parent):
    
        def print_first_name(self):
            print('Bucky')
    
        # The child can also "override" a function that they inherited
        def print_last_name(self):
            print('Snitzleberg')
    
    
    dad = Parent()
    bucky = Child()
    
    dad.print_last_name()
    bucky.print_last_name()
    

    相关文章

      网友评论

          本文标题: Python 32 Programming Tutorial

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