summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/class_inherit_mul.py
blob: 23476132ba6ed3e58a9c1af4e30e39eb65c6087d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class A:
    def __init__(self, x):
        print('A init', x)
        self.x = x

    def f(self):
        print(self.x)

    def f2(self):
        print(self.x)

class B:
    def __init__(self, x):
        print('B init', x)
        self.x = x

    def f(self):
        print(self.x)

    def f3(self):
        print(self.x)


class Sub(A, B):
    def __init__(self):
        A.__init__(self, 1)
        B.__init__(self, 2)
        print('Sub init')

    def g(self):
        print(self.x)

o = Sub()
print(o.x)
o.f()
o.f2()
o.f3()