The super keyword in Ruby is used to call a method from a parent or superclass. This is useful when you want to override a method in a subclass and still access the original method.

For example, say you have a superclass called Animal and a subclass called Cat. The Animal class has a method called speak that prints out “Meow”.

class Animal
def speak
puts “Meow”
end
end

class Cat Purr
# => Meow

Leave a Reply

Your email address will not be published. Required fields are marked *