Protected from super classThey can only be called if the receiver is self or of the same class hierarchy as selfProtected method using self:#class Animal def call self.eat end protected def eat p "I eat." endend animal = Animal.newanimal.call # Output:"I eat."CopyProtected method without using self errors out:#class Animal def call eat end protected def eat p "I eat." endend animal = Animal.newanimal.call # Output:main.rb:4:in `call': private method `eat' called for #<Animal:0x00000000cca8a8> (NoMethodError) from main.rb:15:in `<main>'CopyPrivate method using self errors out:#class Animal def call self.eat end private def eat p "I eat." endend animal = Animal.newanimal.call # Output:main.rb:4:in `call': private method `eat' called for #<Animal:0x00000000cca8a8> (NoMethodError) from main.rb:15:in `<main>'CopyProtected from superclass cannot be called.#class Animal protected def eat p "I eat." endend class Tiger < Animalend tiger = Tiger.newtiger.eat # Output:# $ruby main.rb# main.rb:13:in '<main>': # protected method 'eat' called for #<Tiger:0x005596dc122550> (NoMethodError)CopyProtected from same class cannot be called.#class Animal protected def eat p "I eat." endend animal = Animal.newanimal.eat # Output: # main.rb:10:in `<main>': protected method `eat' called for #<Animal:0x000000023739b0> (NoMethodError) Copy