Created
December 16, 2018 13:39
-
-
Save Fhernd/d1630816d9f2eaf43d4cf85aa3f9626c to your computer and use it in GitHub Desktop.
Uso del método super(). Python.
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 ClaseA: | |
def __init__(self): | |
self.x = 0 | |
def mensaje(self): | |
print('ClaseA.mensaje') | |
class ClaseB(ClaseA): | |
def __init__(self): | |
super().__init__() | |
self.y = 1 | |
def mensaje(self): | |
print('ClaseB.mensaje') | |
super().mensaje() | |
if __name__ == '__main__': | |
claseB = ClaseB() | |
claseB.mensaje() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment