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 50dda64 commit c68cad7Copy full SHA for c68cad7
40-super-1.py
@@ -0,0 +1,28 @@
1
+#!/usr/bin/env python
2
+
3
+# 40-super-1.py
4
5
+# This is an example on how super() works
6
+# in Inheritance.
7
8
+# For more step-by-step details, refer :
9
+# https://arvimal.wordpress.com/2016/07/01/inheritance-and-super-object-oriented-programming/
10
11
12
+class MyClass(object):
13
14
+ def func(self):
15
+ print("I'm being called from the Parent class")
16
17
18
+class ChildClass(MyClass):
19
20
21
+ print("I'm actually being called from the Child class")
22
+ print("But...")
23
+ # Calling the `func()` method from the Parent class.
24
+ super(ChildClass, self).func()
25
26
+my_instance_2 = ChildClass()
27
+my_instance_2.func()
28
0 commit comments