I'm on Python and I'm checking and comparing my understanding with ready-made code on the internet. I'm familiar with the concepts of inheritance but I ran into some code here that confused me!
Although it uses inheritance, I don't understand where it calls the _call function! These functions seem to be called and executed somewhere other than user code.Can someone help me understand it؟
a simple example of inheritance :
class one(object):
def __init__(self,a,b):
self.a = a
self.b = b
def _call(self):
return self.a + self.b
class two(one):
def __init__(self,a,b,c):
super(two,self).__init__(a,b)
self.c = c
def _call_(self):
print(self.c * self.c)
used super() to call the init() of the One class
mt = two(1,2,3)
print(mt._call())