Feb-23-2018, 02:15 PM
can i use my parent class addition answer in child class to do division and how ?
class a:
def __init__(self,x):
self.x=x
def __str__(self):
return 'addition is(%d)'%(self.x)
def __add__(self,other):
c=self.x+other.x
return a(self.x+other.x)
a1=a(2)
a2=a(5)
c=a1+a2
print(c)
class b(a):
