Last active
March 21, 2018 08:31
-
-
Save chj3737/85927cbafcb558d08e5d9e912b65a1ad 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
// 应该可以为接口或是抽象类 | |
interface Component { | |
Object operate(); | |
} | |
class ComponentImpl { | |
Object operate() { } | |
} | |
// 实现接口或是抽象类 | |
class ComponentDecarator implement Component { | |
Component component; | |
ComponentDecarator(Component _component) { | |
component = _component | |
} | |
@Override | |
Object operate() { | |
Object obj = component.operate(); | |
this.doSomething(); | |
return obj; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment