I'm wondering about difference between private and protected in Ruby, there are many sources out there, but they are usually only telling me that private methods cannot be inherited, but in many different ways.
class Person
private
def hello
puts "hello"
end
end
class Student < Person
def initialize
hello
end
end
leo = Student.new
But this very simple example proves this claim to be wrong, private method inherited and used. Also if I change 'private' to 'protected' here, its still gonna give me "hello", while creating leo variable. So how is it with public and protected?