summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/class_inherit1.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/class_inherit1.py')
-rw-r--r--tests/basics/class_inherit1.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/basics/class_inherit1.py b/tests/basics/class_inherit1.py
new file mode 100644
index 0000000000..9ca2d9f14b
--- /dev/null
+++ b/tests/basics/class_inherit1.py
@@ -0,0 +1,21 @@
+class A:
+ def __init__(self, x):
+ print('A init', x)
+ self.x = x
+
+ def f(self):
+ print(self.x, self.y)
+
+class B(A):
+ def __init__(self, x, y):
+ A.__init__(self, x)
+ print('B init', x, y)
+ self.y = y
+
+ def g(self):
+ print(self.x, self.y)
+
+A(1)
+b = B(1, 2)
+b.f()
+b.g()