Created
August 1, 2017 12:22
-
-
Save mess110/216bc123e885658ff3c0c0c42bc37903 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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