> From: nosuzuki / e-mail.ne.jp [mailto:nosuzuki / e-mail.ne.jp]On Behalf Of > Raja S. [...] > 1. Use the class << X > ... > end > > notation to define singleton methods. Since singleton methods are > associated -only- with a -single- object (class or instance) the behind > the scenes mechanism is (now) quite logical: > > 2. How the singleton methods are associated with X depends on what X is: > > . if X is an existing class then the methods just get added to X as > class methods (naturally, no need for an anonymous class). This is not quite correct ... there are such animals as singleton classes of Class objects (the are around when you define class methods but typically go away after you are done with it - that at it is at least my interpretation) $ ruby Ex.rb [B, A, Object] [Class, Class, Class, Module, Object] [Class, Module, Object] [84003776, 84003632, 84038960] [84004136, 84038924, 84038936, 84038948, 84038960] [84038936, 84038948, 84038960] ------------------- require 'SingProb' class A end class B < A end b = B.new bB= b.you # => the singl. class of b BB = B.you # => the singleton class of B BBB = BB.you # => singleton class of BB p bB.superclasses,BB.superclasses,BBB.superclasses p bB.superclasses_id, BB.superclasses_id, BBB.superclasses_id Christoph