[MacRuby-devel] [MacRuby] #516: Subclasses can't access the class variables of their superclass.

MacRuby ruby-noreply at macosforge.org
Sun Dec 20 05:07:57 PST 2009


#516: Subclasses can't access the class variables of their superclass.
------------------------------+---------------------------------------------
 Reporter:  pygy79@…          |       Owner:  lsansonetti@…        
     Type:  defect            |      Status:  new                  
 Priority:  blocker           |   Milestone:  MacRuby 0.5          
Component:  MacRuby           |    Keywords:                       
------------------------------+---------------------------------------------
 At the end of the following story, the heir is rich in MRI, but not in
 MacRuby. The MRI behaviour is described in the "Ruby Programming Language"
 book written by Matz and D. Flanagan, (section 7.3.6).


 {{{
 class FilthyRichGramp
   def self.passes_away
     @@heritage="Brazillions of $!"
     puts "* Gramp dies : (\"Aaaargh...\") \n\n"
   end
 end

 class UnluckyHeir < FilthyRichGramp
   def self.wallet
     cash = "0 $."
     cash = @@heritage if defined? @@heritage
     puts "Lil' bastard: I now have #{cash} \n\n"
   end
 end

 UnluckyHeir.wallet
 FilthyRichGramp.passes_away
 UnluckyHeir.wallet
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/516>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list