Created
October 22, 2012 10:51
-
-
Save raulraja/3930928 to your computer and use it in GitHub Desktop.
Sample Java Façade
This file contains 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 SolidObject { | |
void applyGravity(); | |
void colide(SolidObject other); | |
} | |
interface MovingObject { | |
void run(); | |
void stop(); | |
} | |
.... | |
class Car { | |
SolidObject solidObject; | |
MovingObject movingObject; | |
void go() { | |
solidObject.applyGravity(); | |
movingObject.run(); | |
} | |
void crash(Car other) { | |
movingObject.stop(); | |
solidObject.colide(other.solidObject); | |
other.crash(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment