Created
October 23, 2014 09:59
-
-
Save simonjefford/519c6205f0cfc976ec58 to your computer and use it in GitHub Desktop.
super
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 Base | |
attr_reader :foo | |
def initialize | |
@foo = 42 | |
end | |
end | |
class Super < Base | |
attr_reader :bar | |
def initialize(bar) | |
super() | |
@bar = bar | |
end | |
end | |
s = Super.new("BAR") | |
puts s.foo | |
puts s.bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment