Tom Cloyd
1/21/2009 2:14:00 AM
Zhao Yi wrote:
> Ryan Davis wrote:
>
>> On Jan 20, 2009, at 17:11 , Zhao Yi wrote:
>>
>>
>>> I require two ruby files which include two classes with the same name.
>>> how can I specify which class I use?
>>>
>> class X; end # x.rb
>> class X; end # y.rb
>>
>> same class, only one to specify. Files mean nothing in ruby, they're
>> just vehicles for the parser.
>>
>
> For this code:
>
> require 'x.rb'
> require 'y.rb'
> X.new #which class it uses, can I specify the class like x.X or y.X?
>
Why not answer this empirically? Try it out!
t.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~