I've got the following Ruby code:
class B
class << self
protected
def prot
puts "victory"
end
end
end
class C < B
def self.met
C.prot
end
end
C.met
which tries to proof that protected class methods are inherited in Ruby. The problem is that if I convert met method to an instance method like this:
class B
class << self
protected
def prot
puts "victory"
end
end
end
class C < B
def met
C.prot
end
end
c = C.new
c.met
it won't work. Maybe it has to do with class and instance methods scope?