Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A
- def initialize(parent)
- @parent = parent
- end
- def test
- puts "A::test"
- end
- end
- class B
- def initialize(parent)
- @parent = parent
- end
- def test
- puts "B::test"
- @parent.a.test
- end
- end
- class C
- attr_reader :a, :b
- def initialize
- @a = A.new self
- @b = B.new self
- @b.test
- end
- end
- c = C.new
Add Comment
Please, Sign In to add comment