from abc import ABC,abstractmethod class A(ABC): @abstractmethod def read(self): pass @abstractmethod def write(self): pass def read1(self): self.b=20 def write1(self): print(self.b) class B(A): def read(self): self.a=10 def write(self): print(self.a) b=B() b.read() b.write() b.read1() b.write1()
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