abobaker09

encapculation_hight

Oct 9th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. #التغليف لمستوي اعلا بواسطة القايمة list
  2.  
  3. class beko:
  4.     def __init__(self,**kk):
  5.         self.bb=kk
  6.     def set1(self,x):
  7.     #هنا تم استخدام اندكس خاص بالمتغير لرفع الامن
  8.         self.bb[0]=x
  9.     def get1(self):
  10.         return self.bb[0]
  11.     def set2(self,y):
  12.     #هنا تم استخدام اندكس خاص لرفع الامن
  13.         self.bb[1]=y
  14.     def get2(self):
  15.         return self.bb[1]
  16. b=beko()
  17. b.set1(int(input("enter the numer1\n")))
  18. b.set2(int(input("enter the numer1\n")))
  19. print(b.get1()+b.get2())
Advertisement
Add Comment
Please, Sign In to add comment