Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class X:
- field x1
- field x2
- field x3
- func get_x1:
- return x1
- f(x1, x2):
- - we know that we only need x1, x2
- - we can use x1 and x2 directly, we don't care about how we get them
- - we don't rely on class X getters
- f(X):
- - we don't know which attributes we need, we can use x3 by mistake
- - should get attributes (x1, x2), we will write more code
- - if f needs more x3 we can get it easily without modifying the signature
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement