abobaker09

inheritance_python

Oct 8th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. #الوراثة
  2. class hilal:#الكلاس المورس
  3.     h=8
  4.     u=9
  5.     def g(self):
  6.         return "that is class hilal"
  7. class beko(hilal):#بين القوسين نضع الكلاس المورث
  8.     def y(self):
  9.         return "that is class beko"
  10.  
  11. #beko هو الكلاس الوراث
  12. b=beko()
  13. print(b.h)
  14. print(b.u)
  15. print(b.g())
  16. print(b.y())
Advertisement
Add Comment
Please, Sign In to add comment