From: Rick DeNatale Date: 2009-02-11T07:21:29+09:00 Subject: Re: calling class method from instance .. --001636457596c135b8046297ecd1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, Feb 10, 2009 at 3:27 PM, 7stud -- wrote: > Larz wrote: > > > puts self.class.ctest > > > What's the reason for not simply writing your class like this: > > class Test > @c = 20 > > def Test.a > puts @c > end > > def b > Test.a > end > > end > > t = Test.new > t.b > > --output:-- > 20 > -- > That's fine unless you want to, say, override the class method in a subclass class TestSub < Test def TestSub.a puts "doin my own thang." end end t = TestSub.new t.b --output is still-- 20 -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale --001636457596c135b8046297ecd1--