Created
January 26, 2019 15:47
-
-
Save ajayverse404/8b0d70f43b063ed6cbf64bdf37994a73 to your computer and use it in GitHub Desktop.
solid-blog
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
| public interface Robot { | |
| void run(); | |
| void shoot(); | |
| void swim(); | |
| void fight(); | |
| void walk(); | |
| } | |
| // company A wants to extend the Robot to add Speaking feature | |
| public SpeakingRobot extends Robot { | |
| @Overrides | |
| void run() { | |
| // .. inherits from Robot | |
| } | |
| @Overrides | |
| void shoot() { | |
| // do nothing | |
| // return; | |
| } | |
| @Overrides | |
| void swim() { | |
| // do nothing | |
| // return; | |
| } | |
| @Overrides | |
| void fight(){ | |
| // do nothing | |
| // return; | |
| } | |
| @Overrides | |
| void walk() { | |
| // .. inherits from Robot | |
| } | |
| @Overrides | |
| void speak() { | |
| // code to speak | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment