summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/class_inherit1.py
blob: 9ca2d9f14b40a14375fa9fe77093d901ad9ed45d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()