override your own methods : Overriding Methods « Class « Ruby






override your own methods

class Dog
  def talk
    puts "Woof!"
  end
end

my_dog = Dog.new
my_dog.talk

class Dog
  def talk
    puts "Howl!"
  end
end

my_dog.talk

 








Related examples in the same category

1.Overriding Existing Methods
2.Overriding Methods Demo
3.Override method from parent