-
-
Save amcaplan/4eb569ccee73fd3bb5ba to your computer and use it in GitHub Desktop.
Animals, round 2
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
# IRRELEVANT CODE FOR THIS EXAMPLE HAS BEEN REMOVED | |
class Animal | |
LEGS = 4 | |
def legs | |
self.class::LEGS | |
end | |
end | |
class Octopus < Animal | |
LEGS = 8 | |
end | |
class Llama < Animal | |
end | |
Octopus.new.legs # => 8 | |
Llama.new.legs # => 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment