Created
November 8, 2012 21:00
-
-
Save jimweirich/4041577 to your computer and use it in GitHub Desktop.
Ruby Trivia
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 Dog | |
def wag(tail=my_tail) | |
tail | |
end | |
def my_tail | |
:dogs_tail | |
end | |
end | |
class Cat | |
def wag_dog | |
Dog.new.wag | |
end | |
def my_tail | |
:cats_tail | |
end | |
end | |
puts Cat.new.wag_dog # What is printed here? | |
# Make a prediction before you try it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Putted even more simply it's all about this: