Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface Heater {
- public void heat();
- public void noHeat();
- }
- public interface Cooler {
- public void cool();
- public void noCool();
- }
- public interface Device {
- public void switchOn();
- public void switchOff();
- }
- public class DeviceImpl {
- public DeviceImpl(...) {...}
- public switchOn() {...}
- public switchoff() {...}
- }
- public class Heater {
- Device device;
- public Heater() {
- this.device = new DeviceImpl(...);
- }
- public void heat() {
- this.device.switchOn();
- }
- public void noHeat() {
- this.device.switchOff();
- }
- }
- public class Cooler {
- Device device;
- public Cooler() {
- this.device = new DeviceImpl(...);
- }
- public void cool() {
- this.device.switchOn();
- }
- public void noCool() {
- this.device.switchOff();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement