From: 7stud -- Date: 2009-08-15T21:31:50+09:00 Subject: Re: Class method aliased in superclass bypasses subclass ove I believe your alias version is equivalent to this: ========== class Parent Parent.real_method "Parent" end Parent.fake_method #alias creates a copy of real_method "Parent" end end ========= and your wrapped version is this: ========= class Parent def Parent.real_method "Parent" end def Parent.fake_method real_method #<-----**BIG DIFFERENCE** end end ========= Those Parent classes are clearly not the same. If you add the following code to your wrapped version: ========= class Child < Parent def self.real_method "Child" end end puts Child.fake_method --output:-- Child ========= the message "fake_method" is sent to the Child object (=a class object). The Child object has no method named "fake_method" defined on it, e.g. def Child.fake_message, so lookup proceeds to the superclass class object, i.e. Parent. The Parent object does have the method "fake_method" defined on it, so Parent.fake_method is executed. Parent.fake_method really looks like this: def Parent.fake_method self.real_method end In this case, self is the Child object--because when you write: puts Child.fake_method the fake_method message gets sent to the Child object--in other words Child is calling fake_method, and the caller is self inside a method. Therefore, calling self.real_method (inside fake_method) is equivalent to calling Child.real_method. And calling Child.real_method sends the message real_method to the Child object. As a consequence, a new lookup begins starting with the Child object. Because Child has a method called real_method defined on it, Child.real_method executes. It's highly probable that the above description contains some factual errors, but the esteemed members who previously posted above will surely correct them below. -- Posted via http://www.ruby-forum.com/.