From: Yossef Mendelssohn Date: 2010-11-04T04:34:11+09:00 Subject: Re: the dark side of inherited methods On Nov 3, 3:20 am, Robert Klemme wrote: > > class Rectangle >   attr_reader :width, :height > >   def initialize(width, height) >     @width = width >     @height = height >   end > >   def outline >     2 * ( width + height ) >   end > end > > class Square < Rectangle > >   def initialize(x) >     @width = x >   end > >   def height; width; end > end > > class Rectangle >   def resize(width, height) >     raise ArgumentError if width < 0 || height < 0 >     @width = width >     @height = height >     self >   end > end > > class Square >   def resize(width, height) >     raise ArgumentError if width < 0 || height < 0 || width != height >     @width = width >     self >   end > end I find it interesting that you change a two-argument Rectangle initialization method to take one argument in Square, but you keep the resize method as two arguments. -- -yossef