On Wed, 19 Mar 2008 11:00:28 -0500, Chinna Karuppan wrote: > Hi, > I was trying to redefine new in my class..like this.. > > > class KK > alias oldnew new > def new > yield if block_given? > oldnew > end > end > NameError: undefined method `new' for class `KK' > > why is saying no 'new' method....I don't understand. because I can say > KK.new after I define the class which means the method is there in the > class hierarchy and I should be able to override its implementation.... > > THnks > Chinna I think you want to define the constructor for class KK as: class KK def initialize yield if block_given super end end Does this do what you're trying to accomplish? -- Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/