Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # b_set_and_get.py
- def make_point(x, y):
- def point():
- return ("Point"+str((point.get_x,point.get_y)))
- def set_x(value):
- point.get_x = value
- def set_y(value):
- point.get_y = value
- # Adding getters and setters
- point.get_x = x
- point.set_x = set_x
- point.get_y = y
- point.set_y = set_y
- return point
- 0
- ppp = make_point(123, 456)
- print ppp.get_x
- print ppp.get_y
- print ppp()
- ppp.set_x(21)
- ppp.set_y(99)
- print ppp()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement