Morton Goldberg wrote: > On Dec 2, 2007, at 12:20 AM, Pokkai Dokkai wrote: > >> i want like this (ofcourse below is wrong) >> c1.view ----->from view >> Cls1.pp >> c1.view ----->undefined method `view' for #<Cls1:0xb7daa8b0> >> (NoMethodError) > > > I don't believe you can do what I think you want with 'alias'. Maybe > the following will work for you. > > <code> > class Cls1 > def view > puts "from view" > end > end > > c1 = Cls1.new > c1.view > > class Cls1 > private :view > end > > c1.view > </code> > > <result> > from view > NoMethodError: private method view called for #<Cls1:0x80e10at top > level > in untitled document at line 14 > </result> > > Regards, Morton actualluy all ruby classes are not closed (we can add anything at any time) like as above so how to close a ruby class ? i thing freeze is used to protect modification for object. like that what is used to protect modification for class ? -- Posted via http://www.ruby-forum.com/.