2014-03-10 Rubyのクラス変数は、継承関係にあるクラスで共有される ruby class Super @@x = 1 def self.x @@x end end class Sub < Super @@x = 2 end p Super.x 実行結果は以下のとおり。 2