Created
October 9, 2015 04:40
-
-
Save osyo-manga/d44a5133aaa47914eedd to your computer and use it in GitHub Desktop.
super
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 Base | |
| def homu | |
| p :base | |
| end | |
| end | |
| class Derived < Base | |
| def super | |
| p :super | |
| end | |
| def homu &block | |
| # このブロック内から super を呼び出したい | |
| block.call | |
| # super() | |
| # self.super() | |
| # p :derived | |
| end | |
| end | |
| Derived.new.homu do | |
| super() | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment