Last active
December 26, 2018 12:25
-
-
Save rdcoder33/5fbc3999e8225ac2d765decc9f705561 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): | |
print('I am Superclass') | |
self.super_class_call += 1 | |
class ClassA(Superclass): | |
class_a_call = 0 | |
def class_call(self): | |
#new | |
super().class_call() | |
self.class_a_call += 1 | |
print('I am ClassA') | |
class ClassB(Superclass): | |
class_b_call = 0 | |
def class_call(self): | |
# new | |
super().class_call() | |
self.class_b_call += 1 | |
print('I am ClassB') | |
class ClassC(ClassA, ClassB): | |
class_c_call = 0 | |
def class_call(self): | |
#new | |
super().class_call() | |
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