Created
November 25, 2009 23:11
-
-
Save lsegal/243084 to your computer and use it in GitHub Desktop.
Don't use aliases, they bypass classical inheritance rules you'd expect when you override methods
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 A | |
def read(key) raise NotImplementedError end | |
alias [] read | |
end | |
class B < A | |
def read(key) puts key end | |
end | |
B.new[:x] # NotImplementedError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment