Guest User

Untitled

a guest
Jun 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class A
  2. def initialize(parent)
  3. @parent = parent
  4. end
  5.  
  6. def test
  7. puts "A::test"
  8. end
  9. end
  10.  
  11. class B
  12. def initialize(parent)
  13. @parent = parent
  14. end
  15.  
  16. def test
  17. puts "B::test"
  18. @parent.a.test
  19. end
  20. end
  21.  
  22. class C
  23. attr_reader :a, :b
  24. def initialize
  25. @a = A.new self
  26. @b = B.new self
  27.  
  28. @b.test
  29. end
  30. end
  31.  
  32. c = C.new
Add Comment
Please, Sign In to add comment