python super()继承父类

mac2022-06-30  41

 

 

class Foo(object): def __init__(self, frob, frotz): self.frobnicate = frob self.frotz = frotz class Bar(Foo): def __init__(self, frob, frizzle): super(Bar,self).__init__(frob,34) self.frazzle = frizzle new = Bar("hello","world") print (new.frobnicate ) print (new.frazzle ) print (new.frotz ) >>> hello world 34 View Code

 

转载于:https://www.cnblogs.com/ezway/p/6861578.html

最新回复(0)