From: David Alan Black Date: 2001-10-31T10:24:08+09:00 Subject: [ruby-talk:23893] Re: Overiding a method in another module Hello -- On Wed, 31 Oct 2001, Mark Hahn wrote: > Why can't I just do this to override M1::C1::meth in M2? > > module M1 > class C1 > def meth > p 'M1.meth' > end > end > end > include M1 > > module M2 > class M1::C1 <=== gives syntax error > def meth > p 'M2.meth' > end > end > end > include M2 > > C1.new.meth => M2.meth You can do this: module M1 class C1 def meth p 'M1.meth' end end end include M1 module M2 M1::C1.class_eval < M2.meth David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav