I am learning inheritance and got this problem
class A:
def test(self):
print("test of A called")
class B(A):
def test(self):
print("test of B called")
super().test()
class C(A):
def test(self):
print("test of C called")
super().test()
class D(B,C):
def test2(self):
print("test of D called")
obj=D()
obj.test()
The output is below according to the website where this ques was posted
test of B called
test of C called
test of A called
But in my opinion, the output should be
test of B called
test of A called
Because, class B will be called first (Acc to MRO), and then super().test() is called from class B which will print
test of A called.
Where am I wrong here?