#516: Subclasses can't access the class variables of their superclass.
------------------------------+---------------------------------------------
 Reporter:  pyg...@…          |       Owner:  lsansone...@…        
     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/>

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to