+ 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)
1 Réponse