Created
December 26, 2018 12:04
-
-
Save rdcoder33/f73b92884619b4937ffbdabb49683b7e to your computer and use it in GitHub Desktop.
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 Superclass: | |
super_class_call = 0 | |
def class_call(self): | |
self.super_class_call += 1 | |
print('I am Superclass') | |
class ClassA(Superclass): | |
class_a_call = 0 | |
def class_call(self): | |
Superclass.class_call(self) | |
self.class_a_call += 1 | |
print('I am ClassA') | |
class ClassB(Superclass): | |
class_b_call = 0 | |
def class_call(self): | |
Superclass.class_call(self) | |
self.class_b_call += 1 | |
print('I am ClassB') | |
class ClassC(ClassA, ClassB): | |
class_c_call = 0 | |
def class_call(self): | |
ClassA.class_call(self) | |
ClassB.class_call(self) | |
self.class_c_call += 1 | |
print('I am ClassC') | |
obj_c = ClassC() | |
obj_c.class_call() | |
print( | |
obj_c.super_class_call, | |
obj_c.class_a_call, | |
obj_c.class_b_call, | |
obj_c.class_c_call | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment