Mixins in Ruby?

Ruby does not support multiple inheritance. Instead, it uses Mixins (via include keyword).

module Walkable
  def walk
puts "Walking..."
end end class Person include Walkable end p = Person.new p.walk #

Comments

Leave a Reply

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