Created
January 27, 2016 08:48
-
-
Save nobeans/992838df867c5a1cfe6f to your computer and use it in GitHub Desktop.
staticメソッドの隠蔽
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 Parent { | |
def hoge() { | |
aaa() | |
} | |
def foo() { | |
aaa() | |
} | |
static aaa() { | |
"PARENT" | |
} | |
} | |
class Child extends Parent { | |
def hoge() { | |
aaa() | |
} | |
static aaa() { | |
"CHILD" | |
} | |
} | |
assert new Parent().hoge() == 'PARENT' | |
assert new Parent().foo() == 'PARENT' | |
assert Parent.aaa() == 'PARENT' | |
assert new Child().hoge() == 'CHILD' | |
assert new Child().foo() == 'PARENT' | |
assert Child.aaa() == 'CHILD' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment