Thanks Jean,

Can you please confirm the difference between these:

A.class.hash  #calls the hash method from Class class

A.new.hash  #calls the hash method from A(if overridden otherwise method 
from Object)

A.hash #? not able to understand what hash method is called. What kind 
of object is A?

Regards
Tarun

Jean-Julien Fleck wrote:
> 2010/5/15 Tarun Yadav <sameeryadav.eck2003 / gmail.com>:
>> But the value returned in both cases are different.
> The class of A is "Class" (which is itself an object different from
> A). So it's perfectly normal that the hash method returns an other
> value.
> 
> Try A.object_id and A.class.object_id:
> 
>>> Array.object_id
> => 2148226700
>>> Array.class
> => Class
>>> Array.class.object_id
> => 2148257020
>>> Class.object_id
> => 2148257020
> 
> Array.class and Class are the same object.
> 
> Cheers,

-- 
Posted via http://www.ruby-forum.com/.