python the method of super function

来源:互联网 发布:mac白屏很久 编辑:程序博客网 时间:2024/04/30 12:50

class C:
def init(self):
print(‘enter C’)
print(‘leave C’)
class A:
def init(self):
print(“enter A”)
print(“leave A”)
class B(A): # A –> C
def init(self):
print(“enter B”)
super(B, self).init()
print(“leave B”)

if name == ‘main‘:
b = B()

原创粉丝点击