0
inheritance - Function "super".
class A: def spam(self): print(1) class B(A): def spam(self): print(2) super().spam() B().spam() Can anyone please explain this code ?????? Thanks in advance.
1 Answer
+ 1
B inherits from A.
super().spam() calls the method of the 'mommy' of B.
So when you call B's spam, it will print 2, then call A's spam which will print 1.