Skip to content

Instantly share code, notes, and snippets.

@tstone
Created August 10, 2017 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tstone/6c2c9f6b2c3ecb33f1b16df50cd85841 to your computer and use it in GitHub Desktop.
Save tstone/6c2c9f6b2c3ecb33f1b16df50cd85841 to your computer and use it in GitHub Desktop.
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