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()
阅读(949) | 评论(0) | 转发(0) |