Created
August 24, 2012 18:21
-
-
Save midu/3453908 to your computer and use it in GitHub Desktop.
be careful when you define classes in modules!
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 A | |
| def a | |
| "a from A" | |
| end | |
| end | |
| module B; end | |
| class B::A | |
| def a | |
| "a from B" | |
| end | |
| end | |
| class B::C < A | |
| end | |
| module B | |
| class D < A | |
| end | |
| end | |
| B::C.new.a # => "a from A" | |
| B::D.new.a # => "a from B" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment