Created
October 18, 2009 17:29
-
-
Save jballanc/212757 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
irb(main):001:0> class A | |
irb(main):002:1> def test(thing) | |
irb(main):003:2> puts "#{thing}! from class A!" | |
irb(main):004:2> end | |
irb(main):005:1> end | |
=> nil | |
irb(main):006:0> class B < A | |
irb(main):007:1> def test(thing) | |
irb(main):008:2> super(thing) | |
irb(main):009:2> puts "...and now from class B too!" | |
irb(main):010:2> end | |
irb(main):011:1> end | |
=> nil | |
irb(main):012:0> b = B.new | |
=> #<B:0x2002cbcc0> | |
irb(main):013:0> b.test("chunky bacon") | |
chunky bacon! from class A! | |
...and now from class B too! | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment