From: Robert Dober Date: 2006-06-21T07:02:08+09:00 Subject: Re: Achieve pure object oriented design in Ruby ------=_Part_64069_15016928.1150840923516 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 6/20/06, Jeff Cohen wrote: > > NAYAK wrote: > > A), there would be an overhead of adding a large number of wrapper > > methods > > for members of classes B and C. > > I haven't had time to think through it completely, but what if you > overrode method_missing in A? Your method_missing could find out if > B.responds_to? the message, and if so, send() it the message along with > the original arguments. The delegation is not a problem, though an elegant way to do it might require some skills. The real problem is requirement 2) of the OP, instanciation of class B shall only be possible in class A, e.g. in an instance of A, I do not think this is possible, but I would not bet on it (not much). It would already be nice to have some code which defends against the vanill= a instanciation of B outside of an A instance. I did not yet come up with such a solution though. Any ideas? Cheers Robert Just a thought. > > Jeff > softiesonrails.com > > > -- > Posted via http://www.ruby-forum.com/. > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_64069_15016928.1150840923516--