Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. class Human:
  2.     @classmethod
  3.     def mynameis(cls):
  4.         print("Human said: I'm {0}".format(cls.__name__))
  5.  
  6. class Pepa(Human):
  7.     @classmethod
  8.     def mynameis(cls):
  9.         print("Pepa said: I'm {0}".format(cls.__name__))
  10.         cls.__super.mynameis()
  11.  
  12. Pepa._Pepa__super = super(Pepa, Pepa)
  13.  
  14. Pepa().mynameis()
  15.  
  16. class Josef(Pepa):
  17.     pass
  18.  
  19. Josef._Josef__super = super(Josef)
  20.  
  21. Josef().mynameis()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement