Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1074931
  • 博文数量: 120
  • 博客积分: 887
  • 博客等级: 准尉
  • 技术积分: 1883
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-05 21:10
个人简介

RHCE,CCNA,熟悉shell脚本

文章分类

全部博文(120)

文章存档

2015年(16)

2014年(20)

2013年(48)

2012年(20)

2011年(16)

分类: Python/Ruby

2013-12-08 15:13:28


class Parent(object):
    def faltered(fself):
        print "PARENT altered()"

class Child(Parent):
    def saltered(sself):
        print "CHILD, BEFORE PARENT altered()"
        super(Child, sself).faltered()                           #使用super调用用parent中的faltered中的参数,并传递给child中的sself
        print "CHILD, AFTER PARENT altered()"

dad = Parent()
son = Child()

dad.faltered()
son.saltered()
阅读(907) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~