From: Aredridel Date: 2006-02-13T05:16:30+09:00 Subject: Re: Struct creates non-standard classes On Mon, 2006-02-13 at 04:45 +0900, Mark Volkmann wrote: > If Struct is a shorthand way for creating Classes, why don't objects > created from those Classes have instance_variables? > > Struct.new 'Car', :make, :model, :year > c = Struct::Car.new 'Saturn', 'SC2', 1997 > c.instance_variables => [] > c.members => ["make", "model", "year"] > > Note that members is an instance method of Struct, whereas > instance_variables is an instance method of Object. Because they're not stored as instance variables.