Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created December 16, 2018 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/d1630816d9f2eaf43d4cf85aa3f9626c to your computer and use it in GitHub Desktop.
Save Fhernd/d1630816d9f2eaf43d4cf85aa3f9626c to your computer and use it in GitHub Desktop.
Uso del método super(). Python.
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