class C
def C.x # self.x, C == self, self is C
puts "Class method: <C.x> of class C"
puts "self: #{self}"
end
end
C.x # self.x
class C
def C.x
puts "Class method: <C.x> of class C"
puts "self: #{self}"
end
end
class D < C
end
C.x # self.x -> self is C
D.x # self.x => self is D
class Test
def talk
end
end
obj = Test.new
obj.talk
# same as self.talk
Top comments (0)