Advertisement
Fhernd

invocar_metodo_superclase.py

Dec 16th, 2018
1,627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. class ClaseA:
  2.     def __init__(self):
  3.         self.x = 0
  4.    
  5.     def mensaje(self):
  6.         print('ClaseA.mensaje')
  7.  
  8. class ClaseB(ClaseA):
  9.     def __init__(self):
  10.         super().__init__()
  11.         self.y = 1
  12.    
  13.     def mensaje(self):
  14.         print('ClaseB.mensaje')
  15.         super().mensaje()
  16.  
  17.  
  18. if __name__ == '__main__':
  19.     claseB = ClaseB()
  20.     claseB.mensaje()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement