Fhernd icon

invocar_metodo_superclase.py

Fhernd | PRO | 12/16/18 12:39:16 PM UTC | 0 ⭐ | 2952 👁️ | Never ⏰ | []
Python |

380 B

|

None

|

0 👍

/

0 👎

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()

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎