From: Joel VanderWerf Date: 2002-07-04T03:40:57+09:00 Subject: Re: Class.forName("Array") Sylvia Chai wrote: > Is it possible to create an object of the class > 'Class' dynamically? > > Fox example: to create an object of 'Class' with the > value of 'Hash' by something like: Class.new('Hash') > or Class.forName('Hash') How about Class.new(Hash)? This creates an anonymous subclass of Hash. If you assign to a constant, like this: MyHash = Class.new(Hash) then the subclass will be associated with the name 'MyHash': p MyHash.new.class ==> MyHash