How do I pass arguments to the superclass constructor while creating an object of the subclass in this case? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I pass arguments to the superclass constructor while creating an object of the subclass in this case?

class Super: def __init__(self,x,y) self.x=x self.y=y def show(self): print("This prints multiplication") print(self.x*self.y) class Sub(Super): def __init__(self,a,b): self.a= a self.b=b def Show(self): print("This prints addition) print(self.a+self.b)

15th May 2019, 1:56 AM
Debraj Singh
Debraj Singh - avatar
0 Answers