From: Gennady Bystritsky Date: 2012-08-08T19:48:01+09:00 Subject: Re: Initializer with self On Aug 8, 2012, at 3:32 AM, Iwan B. wrote: > I have tho classes A and B1, and b is defined as: > > a = A.new > b = a.foo # b is an instance of class B1 > > I would like to define b directly: > b = B2.new > > where the class B2 is defined: > class B2 > def initialize > a = A.new > self = a.foo # <<< error! > end > ... > end > > But i cannot define self in the constructor... > You cannot re-define self, it is defined for you to be the current instance of class B2. Why do you need it? Even if it were possible, don't you find it weird - you create and instance of B2 with B2.new, but get back the instance of B1? Gennady.