Last active
November 18, 2019 15:18
-
-
Save Naomi-Dennis/95d7c1b1e05623a27c645cab42cf4f98 to your computer and use it in GitHub Desktop.
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
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