Created
August 10, 2017 19:33
-
-
Save tstone/6c2c9f6b2c3ecb33f1b16df50cd85841 to your computer and use it in GitHub Desktop.
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 | |
@value = "a" | |
def self.print | |
puts @value | |
end | |
end | |
class B < A | |
@value = "b" | |
end | |
class C < A | |
@value = "c" | |
def self.print | |
puts @value + " -- printed by C" | |
end | |
end | |
C.print # "c -- printed by C" | |
B.print # "b" | |
A.print # "a" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment