From: Patrick Zesar Date: 2003-08-21T20:33:27+09:00 Subject: Re: Class variables - a surprising result > class Sup > @@x = "A" > def test > print @@x > end > end > > class Sub1 < Sup > @@x = "B" > end > > class Sub2 < Sup > @@x = "C" > end > > Sup.new.test > Sub1.new.test > Sub2.new.test > > > I expect this to print "ABC", and yet it prints "CCC". Why is this? hwow - for the stupid (me): @@x seems to be the same thing for the whole inheritance-hierarchy (or whatever this thing is called)... but i thought every class has it's very own class-vars.... i mean... what's the purpose of that? hmmm. i did never notice this. i guess it just seems so strange due to me not being familiar with it this way... and - am i right? - in java it would say ABC, wouldn't it? strange... patrick