We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9eafb0 commit eb24eebCopy full SHA for eb24eeb
Beginner_Level/super( ).py
@@ -0,0 +1,21 @@
1
+
2
+class Parent:
3
+ def __init__(self, name):
4
+ print('Parent __init__', name)
5
6
7
+class Parent2:
8
9
+ print('Parent2 __init__', name)
10
11
+class Child(Parent, Parent2):
12
+ def __init__(self):
13
+ print('Child __init__')
14
+ super().__init__('chamn') # to call the __init__ of superclas
15
+ # Parent.__init__(self, 'ram')
16
+ # Parent2.__init__(self, 'max')
17
18
+child = Child()
19
+print(Child.__mro__) # mro method resoution order. After running u can see that 1st method of child class executed then parents class method
20
21
0 commit comments