From: Robert Klemme Date: 2012-09-28T01:42:16+09:00 Subject: Re: Subclassing Date On Thu, Sep 27, 2012 at 2:30 PM, Damián M. González wrote: >> Why are you subclassing Date in the first place? > > Well, the class Dia(It's day in spanish) represent a day. Each instance > of this class have like 10 inst. variables. I wanted to subclass Date > because I want to be available +() or -() or cweek() to a Dia instance, > in the way that it behave like a Date object does. Then better use composition as has been suggested. Inheriting core classes is rarely a good idea. What you have is actually something else which happens to have a data attached to it as well. If you need numeric operations one of my blog articles might help you to implement operators properly: http://blog.rubybestpractices.com/posts/rklemme/019-Complete_Numeric_Class.html Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/