From: Brian Candler Date: 2012-08-09T02:41:32+09:00 Subject: Re: Initializer with self Iwan B. wrote in post #1071643: > class B2 > def initialize > a = A.new > self = a.foo # <<< error! > end > ... > end It *is* possible to override the 'new' method: class B2 def self.new return A.new end end But this is very likely to confuse people who call B2.new and expect to get an instance of B2. If you want to choose the class dynamically then the normal approach is a factory method: class B2 def self.create(*args) klass = pick_a_class # choose your own logic here klass.new(*args) end end But it seems to me that subclassing is closest to what you're trying to achieve (making something which is like a workbook, but slightly modified) -- Posted via http://www.ruby-forum.com/.