class A: def __init__(self): self.a=10 def write(self): print(self.a) class B(A): def __init__(self): super().__init__() self.b=20 def write(self): super().write() print(self.b) b1=B() b1.write()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter