From: Marco Guay Date: 2001-08-24T06:49:50+09:00 Subject: [ruby-talk:20210] Inherit singleton method? I'm a newbie in Ruby, exploring the language from early this summer with the book PR. I have followed the newsgroup with interest for the past three weeks, and I'm now posting my first message. I would like to know, just by curiosity (I'm not aware of real-life situations/scenarios where it would be interesting using singleton methods), if it's possible to inherit from the modified class defined for a particular object. Let me explain with an example (writing in english is not my strong point): # -- beginning of the example class OriginalClass attr_accessor :value def initialize(value) @value = value end end myObj = OriginalClass.new(30) class << myObj def doSomething puts 'something' end end myObj.doSomething # -- end of example I would like to create, just by curiosity (not a real-life situation), a new object (like 'otherObj') based on OriginalClass, but with the specific definition of 'x' (new method 'doSomething' included). By intuition, I could do: otherObject = x.new # not very interesting or otherObject = x.class.new # if class could be the modified local copy of the class (if I can say that) So, I would like to know if it's possible to inherit from the ~direct~ (Programming Ruby, page 245) class of an object, instead of the original class. Thank you Marco Guay D�partement d'informatique Coll�ge de la r�gion de L'Amiante FYI: bash-2.03$ ruby --version ruby 1.6.3 (2001-03-19) [i386-solaris2.8]