super().__init__()参数如何传递
如下代码:class A:
def __init__(self,arg):
self.arg = arg
print("FishA")
class B(A):
def __init__(self,abc):
self.abc = abc
super().__init__()
print("FishB")
b = B(520)
如何给arg参数传递实参? class A:
def __init__(self,arg):
self.arg = arg
print("FishA")
class B(A):
def __init__(self,abc, arg):
self.abc = abc
super().__init__(arg)
print("FishB")
b = B(520, "arg")
class A:
def __init__(self,arg):
self.arg = arg
print("FishA")
class B(A):
def __init__(self,abc):
self.abc = abc
super().__init__("arg")
print("FishB")
b = B(520)
class A:
def __init__(self,arg):
self.arg = arg
print("FishA")
class B(A):
def __init__(self,abc, arg):
self.abc = abc
super().__init__(arg)
print("FishB")
b = B(520, "arg")
页:
[1]