I would like to have each class to have different or same variables and inherit with final class as below
class a(object):
def __init__(self, x, y):
self.x = x
self.y = y
def add(self):
return self.x + self.y
class b(object):
def __init__(self, u, v):
self.u = u
self.v = v
def mul(self):
return self.u*self.v
class c(a, b):
def __init__(self,x,y,u,v,w):
super(c,self).__init__(x,y,u,v,w)
self.w = w
def div(self):
return (self.x+self.y+self.u+self.v)/self.w
Error as:
ob = c(1,2,3,4,5)
Traceback (most recent call last):
File "<ipython-input-20-0c1a3250f4a1>", line 1, in <module>
ob = c(1,2,3,4,5)
File "<ipython-input-19-5734ec980138>", line 20, in __init__
super(c,self).__init__(x,y,u,v,w)
TypeError: __init__() takes 3 positional arguments but 6 were given
How to fix error?