From: Rick DeNatale Date: 2006-08-06T13:30:09+09:00 Subject: Re: Inheritance with class-variables On 8/5/06, Yochen Gutmann wrote:> Hi Lopex,>> Marcin Miel�y�ski wrote:> >> > def info_temperature> > puts "My body temperature is "+self.class.temperature.to_s+"> > degree"> > end>> indeed, it worked! Thanx for your hint. But still I cant see how Ruby's> class variables work. Do you know any good literature about that topic?> I poke around in the pickaxe but found nothing about this specific> topic. Pickaxe 2nd edition p 332 "Class variables are shared by children of the class in which they arefirst defined" followed by an example. The section called "Class Instance Variables" starting on page 388,describes the syntax and semantics of instance variables of classes.These are NOT the same as class variables, which are really justvariables defined in the namespace of the class. In fact, it might be more accurate to call those @@variables modulevariables instead, since they can be defined within modules. After allclasses can't do much more than modules can. Class inherits almosteverything from Module, except for the allocation of instances, andthe ability to form an inheritance hierarchy. -- Rick DeNatale IPMS/USA Region 12 Coordinatorhttp://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Sitehttp://www.mercuryspacecraft.com/