From: 7stud -- Date: 2008-02-15T09:08:34+09:00 Subject: Re: object specific methods and id UpsNDowns wrote: > Hi, > > If I create an object specifc method foo on my string instance obj, a > new anonymous class (the singleton, I gather) is created and obj is > considered an instance of that. > According to pickaxe2, that is correct. However, the anonymous class is called an 'anonymous' for a reason: it has no name. So, what would obj.class return if that were to retrieve the name of the anonymous class? nil? I would imagine the anonymous class does not have a .class attribute, so the lookup for .class proceeds up the inheritance chain, something like this: class Dog attr_accessor :name def initialize @name = "Rover" end end #------------------- class IntermediateClass < Dog end #------------------- class Puppy < IntermediateClass end p = Puppy.new puts p.name --output:-- Rover -- Posted via http://www.ruby-forum.com/.