From: "David A. Black" Date: 2004-08-11T08:55:33+09:00 Subject: Re: stupid question: Object#name Hi -- On Wed, 11 Aug 2004, Gavri Savio Fernandez wrote: > > From: Mark Hubbart > > Subject: Re: stupid question: Object#name > > > This is a fairly common OO topic, and there is a pretty good > > description of classes and objects here: > > > > http://www.visibleworkings.com/little-ruby/Chapter3.pdf > > One part of this chapter (Page 5) is driving me crazy. I tried it in irb and it doesn't work as described in the chapter. > > >From the book (paraphrased(?)......sort of) > > #################################################### > class Celery > end > > class IceCream > def IceCream.new(starting_licks) > Celery.new > end > end > > class IceCream > def IceCream.small > new(80) > end > end > > ....I can send messages to what > class answers, like this: > > food = IceCream.small > more_food = food.class.small > > Both food and more_food would be > instances of Celery. > ####################################################### > > I understand how food is an instance of Celery. > But how is more_food an instance of Celery? It isn't. Maybe Brian meant that second line to be: more_food = food.class.new but I'm not sure. David -- David A. Black dblack@wobblini.net