abobaker09

encapculation_low

Oct 9th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. #التغليف المستوي المنخفض او العادي
  2. class beko:
  3.     def __init__(self,x=0,y=0):
  4.         self.x=x
  5.         self.y=y
  6.         #الدالة set لوضع قيمة العنصر
  7.     def _set_(self,x):
  8.         self.x=x
  9.     def _get_(self):
  10.         return self.x
  11.         #الدالة getلطباعه العنصر
  12.     def _set1_(self,y):
  13.         self.y=y
  14.     def _get1_(self):
  15.         return self.y
  16. b=beko()
  17. b._set_(8)
  18. b._set1_(9)
  19. print(b._get_()+b._get1_())
Advertisement
Add Comment
Please, Sign In to add comment