ITP2 - OOP Tutorials - Inheritance - Private, P...

fido = Animal.new
fido.a_public_method        # => Will this work? Yes, I'm protected!

The above line of code shows us that we can call a protected method from
within the class, even with self prepended. What about outside of the
class?

fido.a_protected_method
  # => NoMethodError: protected method `a_protected_method' called for
    #<Animal:0x007fb174157110>

This demonstrates the second rule, that we can't call protected methods
from outside of the class. The two rules for protected methods apply
within the context of inheritance as well.