|
看過一些書說super()會自動找到所有父類,並自動調用該父類的__init__()構造方法,但我試過後,發現super()只執行了首個繼承的父類的init方法,如果要調用所有的父類init,應該怎麼寫?
class gee:
def __init__ ( self ):
print ( "X" )
class yee:
def __init__ ( self ):
print ( "Y" )
class gee2(gee,yee) :
def __init__ ( self ):
super (). __init__ ( )
a = gee2() #結果輸出:X
|
|