Created
October 26, 2010 14:38
-
-
Save yitsushi/647012 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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