Created
September 2, 2015 18:16
-
-
Save evandrojr/9841e45f575e799a25f6 to your computer and use it in GitHub Desktop.
Ruby OO
This file contains 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 myTask < Task # myTask is a subclass of Task | |
end | |
module Foo | |
def foo | |
puts 'heyyyyoooo!' | |
end | |
end | |
class Bar | |
include Foo | |
end | |
Bar.new.foo # heyyyyoooo! | |
Bar.foo # NoMethodError: undefined method ‘foo’ for Bar:Class | |
class Baz | |
extend Foo | |
end | |
Baz.foo # heyyyyoooo! | |
Baz.new.foo # NoMethodError: undefined method ‘foo’ for #<Baz:0x1e708> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment