Advertisement
Zadyk

Untitled

Aug 4th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. class Building:
  2.  
  3. def __init__(self, adress, nb_stairs):
  4. self.adress = adress
  5. self.stairs = nb_stairs
  6.  
  7. def get_adress(self):
  8. return self.adress
  9.  
  10. def stairs(self):
  11. return self.stairs
  12.  
  13.  
  14. class Residence(Building):
  15.  
  16. def __init__(self, adress, nb_stairs, balcony):
  17. super().__init__(nb_stairs,adress,)
  18. self.nb_balcony = balcony
  19.  
  20. def get_nb_balcons(self):
  21. return self.nb_balcony
  22.  
  23.  
  24. class Supermarket(Building):
  25.  
  26. def __init__(self, adress, nb_stairs, nb_rayons):
  27. super().__init__(adress, nb_stairs)
  28. self.nb_rayons = nb_rayons
  29.  
  30. def get_nb_rayons(self):
  31. return self.nb_rayons
  32.  
  33.  
  34. class Bank(Building):
  35.  
  36. def __init__(self, adress, nb_stairs, chest, name):
  37. super().__init__(adress, nb_stairs)
  38. self.nb_chest = chest
  39. self.name = name
  40.  
  41. def get_nb_chest(self):
  42. return self.nb_chest
  43. print("le nombre de coffres est de", nb_stairs)
  44.  
  45. def get_name(self):
  46. return self.name
  47.  
  48.  
  49. if issubclass(Residence, Building):
  50. print("La classe residence est bien une classe parent de Building")
  51. if issubclass(Bank, Building):
  52. print("La classe Bank est bien une classe parent de Building")
  53. if issubclass(Supermarket, Building):
  54. print("La Supermaket residence est bien une classe parent de Building")
  55.  
  56. #4 buildings
  57. residence1 = Residence("26 galere de nulle part", 2, 1,)
  58. #Supermarket
  59. supermarket1 = Supermarket("33 av des fleurs", 2, 59)
  60. #Bank
  61. bank1 = Bank("44 rue ptain merde)", 3,2, "Voleur",)
  62.  
  63. print(residence1)
  64. print(supermarket1)
  65. print(bank1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement