From: "David A. Black" Date: 2009-12-20T04:18:13+09:00 Subject: Re: special cased? Hi -- On Sat, 19 Dec 2009, Roger Pack wrote: > This confused me a bit > > class A > @a = 2 > @@a = 3 > def self.a > puts [@a, @@a] > end > end > > class B < A; end > > A.a # [2, 3] > B.a # [nil, 3] > > shouldn't @a just lookup @@a in the parent? Different treatment for > different types of variables? I think you mean shouldn't it just look up @a (not @@a) in the parent -- and the answer is no :-) A and B are different objects, and therefore do not share instance variables. David -- David A. Black Senior Developer, Cyrus Innovation Inc. THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally! January 22-23, Tampa, Florida Info and registration at http://www.thecompleatrubyist.com