I'm very confused at the moment regarding inheritance. I have a class
that inherits from Time as in:

class RTDate < Time
 ...my methods adding to the class
end

I have the initialize method inherit from the parent class. Here is
where I get confused:
irb(main):001:0> require 'rtdate2.rb'
=> true
irb(main):002:0> r = RTDate.new
=> Mon May 14 09:12:06 PDT 2007
irb(main):003:0> r.class
=> RTDate
irb(main):004:0> s = r.yesterday
=> Sun May 13 09:12:06 PDT 2007
irb(main):005:0> s.class
=> Time
irb(main):006:0>

Here is what I don't understand - why does s become a Time object
instead of an RTDate object. If I do s = r, then I can get all of my
methods out because s becomes an RTDate object. I'm really confused
because the yesterday method is specific to my RTDate class so how can
the resulting object be a time?
Below is an excerpt from my class thus far:
class RTDate < Time
   def yesterday
       self - (60*60*24)
   end
end

-- 
Posted via http://www.ruby-forum.com/.