Guest User

Untitled

a guest
Jan 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Class X(object):
  2. def notify(self):
  3. print "notifying..."
  4.  
  5. Class A(object):
  6. def __init__(self):
  7. self.x = X()
  8. self.b = B(self.x)
  9. self.d = D(self.x)
  10.  
  11. Class B(object):
  12. def __init__(self, x):
  13. self.x = x
  14.  
  15. def notify(self):
  16. self.x.notify('from B')
  17.  
  18. Class D(object):
  19. def __init__(self, x):
  20. self.x = x
  21.  
  22. def notify(self):
  23. self.x.notify('from D')
  24.  
  25. a = A()
Add Comment
Please, Sign In to add comment