In the code below the i have called the constructor of class A in class B but I need to pass self in the parameters. Why do we to pass self that is a reference to object B to the constructor of A? Using Python 3.7.3
class A:
def __init__(self,a):
self.a = a
def get_a(self):
print(self.a)
class B(A):
def __init__(self,a,b):
A.__init__(self,a)
self.b = b
def get_b(self):
print(self.a)
print(self.b)
a = A(5)
b = B(50,60)
a.get_a()
b.get_a()
b.get_b()