Created
August 22, 2016 08:22
-
-
Save danishsatkut/20587f9f8906d35563b58a7859173298 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 PoweredDevice { | |
public void start(); | |
} | |
class ScanOperation { | |
public void perform() { | |
// Performing scan operation | |
} | |
} | |
class PrintOperation { | |
public void perform() { | |
// Perform print operation | |
} | |
} | |
class Scanner implements PoweredDevice { | |
private ScanOperation operation; | |
public void start() { | |
// Use operation.perform() | |
} | |
} | |
class Printer implements PoweredDevice { | |
private PrintOperation operation; | |
public void start() { | |
// Use operation.perform() | |
} | |
} | |
class Copier implements PoweredDevice { | |
private ScanOperation scanOperation; | |
private PrintOperation printOperation; | |
public void start() { | |
// Use each operations | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment