Advertisement
Chl_Snt

Super

Feb 24th, 2023
757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. class Mommy:
  2.     def __init__(self):
  3.         super().__init__()
  4.         self.eye1 = 'blue'
  5.         self.hair_color1 = 'brown'
  6.         self.height1 = '180'
  7.  
  8.     def eyes(self):
  9.         print(f'Глаза:{self.eye1}')
  10.  
  11.     def hair(self):
  12.         print(f'Цвет волос:{self.hair_color1}')
  13.  
  14.     def height(self):
  15.         print(f'Рост:{self.height1}')
  16.  
  17.  
  18. class Daddy:
  19.     def __init__(self):
  20.         super().__init__()
  21.         self.eye2 = 'gary'
  22.         self.hair_color2 = 'red'
  23.         self.height2 = '160'
  24.  
  25.     def eyes(self):
  26.         print(f'Глаза:{self.eye2}')
  27.  
  28.     def hair(self):
  29.         print(f'Цвет волос:{self.hair_color2}')
  30.  
  31.     def height(self):
  32.         print(f'Рост:{self.height2}')
  33.  
  34.  
  35. class Child(Mommy, Daddy):
  36.     def __init__(self):
  37.         super().__init__()
  38.  
  39.  
  40.     def coll_eyes(self):
  41.         Mommy.eyes(self)
  42.  
  43.     def coll_height(self):
  44.         Daddy.height(self)
  45.  
  46.  
  47.  
  48. mice = Child()
  49. mice.coll_eyes()
  50. mice.coll_height()
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement