Last active
August 29, 2015 14:15
-
-
Save esoergel/ba14cbd9a5c469a33dd1 to your computer and use it in GitHub Desktop.
Python multiple inheritance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A1(object): | |
def __init__(self): | |
print "Class A1" | |
super(A1, self).__init__() | |
class A2(A1): | |
def __init__(self): | |
print "Class A2" | |
super(A2, self).__init__() | |
class B1(object): | |
def __init__(self): | |
print "Class B1" | |
super(B1, self).__init__() | |
class B2(B1): | |
def __init__(self): | |
print "Class B2" | |
super(B2, self).__init__() | |
class C(B2, A2): | |
def __init__(self): | |
print "Class C" | |
super(C, self).__init__() | |
C() | |
# Output: | |
Class C | |
Class B2 | |
Class B1 | |
Class A2 | |
Class A1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment