From: Abder-Rahman Ali Date: 2010-08-23T23:30:11+09:00 Subject: Re: Class initialization Andrew Wagner wrote: > # just means "an instance of the class Foo". That crazy hex at > the > end (0x...) is just the reference to the instance in memory, so that, > you > could tell two different instances apart. > > Basically, what's happening here is that there's a default instance of > to_s > which knows how to look up what class the object is an instance of, look > up > the memory reference, and return that string. When you define to_s > yourself, > you're overriding that default implementation to return something that's > (hopefully) more useful for you. > > On Mon, Aug 23, 2010 at 10:08 AM, Abder-Rahman Ali < Thanks a lot Andrew. It is becoming more clear now. I'm just still not getting this point if you just can explain it further: asically, what's happening here is that there's a default instance of to_s which knows how to look up what class the object is an instance of, look up the memory reference, and return that string. -- Posted via http://www.ruby-forum.com/.