Skip to content

Instantly share code, notes, and snippets.

@mess110
Created August 1, 2017 12:22
Show Gist options
  • Save mess110/216bc123e885658ff3c0c0c42bc37903 to your computer and use it in GitHub Desktop.
Save mess110/216bc123e885658ff3c0c0c42bc37903 to your computer and use it in GitHub Desktop.
class Being
def move
puts 'moving'
end
end
class Human < Being
end
# Human has the move method due to inheritance
Human.new.move
module Movable
def move
puts 'moving'
end
end
class Animal
include Movable
end
# Animal has the move method due to composition
Animal.new.move
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment