Created
March 21, 2014 10:55
-
-
Save shakthimaan/9683735 to your computer and use it in GitHub Desktop.
How to invoke Test.hello() from class Alpha/Beta?
This file contains 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
module Hello | |
class Test | |
attr_accessor :registers | |
def initialize() | |
@registers = [] | |
@registers << Alpha.new | |
@registers << Beta.new | |
end | |
def display | |
p @registers | |
end | |
def hello() | |
p "Hello" | |
end | |
end | |
class Alpha | |
def initialize() | |
@registers = "Alpha" | |
# How to call Test.hello() from here? | |
end | |
end | |
class Beta | |
def initialize() | |
@registers = "Beta" | |
end | |
end | |
end | |
h = Hello::Test.new() | |
h.display() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment