Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Created October 26, 2010 14:38
Show Gist options
  • Save yitsushi/647012 to your computer and use it in GitHub Desktop.
Save yitsushi/647012 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment