Skip to content

Instantly share code, notes, and snippets.

@Naomi-Dennis
Last active November 18, 2019 15:18
Show Gist options
  • Save Naomi-Dennis/95d7c1b1e05623a27c645cab42cf4f98 to your computer and use it in GitHub Desktop.
Save Naomi-Dennis/95d7c1b1e05623a27c645cab42cf4f98 to your computer and use it in GitHub Desktop.
class Laptop{}
/* Added video interface */
interface VideoCable{
public void connect(Laptop device);
}
class DisplayPortCable implements VideoCable{
public void connect(Laptop device){
connectedDevice = device;
}
private Laptop connectedDevice;
}
class Monitor{
public Monitor(VideoCable videoConnector){
this.videoConnector = videoConnector;
}
public void connectToDevice(Laptop device){
videoConnector.connect(device);
}
private VideoCable videoConnector;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment