From: 7stud -- Date: 2011-08-26T11:27:05+09:00 Subject: Re: calling a descendant's method Alexey Muranov wrote in post #1018528: > No it returns "Hoho"! > Now i am confused... ruby moves up the inheritance hierarchy until it finds f(): def f g() end f() executes and inside f() ruby finds the statement: g() ruby must call all methods with an object, and if you don't specify the object that is calling the method, then ruby uses self. So g() is equivalent to: self.g() What is self? self is the object that called the method. What object called the method? An instance of B called f(), so inside f() self='the B instance'. That means self.g is equivalent to: 'the b instance'.g() So ruby checks the B class for a method called g(). -- Posted via http://www.ruby-forum.com/.