diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-31 18:03:52 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-31 18:03:52 +0100 |
commit | 18a6eb9e133b62134366ebab0d5c21222f523dbc (patch) | |
tree | 02f8e5e741a2eae35fbf27b5bc7b04775f0de846 /tests | |
parent | 3ff2d038912cba10f856f47cefbabf68f84cb098 (diff) | |
parent | 183faa3b13d933a201f909465f8fcd432d616e04 (diff) | |
download | micropython-18a6eb9e133b62134366ebab0d5c21222f523dbc.tar.gz micropython-18a6eb9e133b62134366ebab0d5c21222f523dbc.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/class_inherit_mul.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/basics/class_inherit_mul.py b/tests/basics/class_inherit_mul.py new file mode 100644 index 0000000000..23476132ba --- /dev/null +++ b/tests/basics/class_inherit_mul.py @@ -0,0 +1,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() |