26 lines
836 B
D
26 lines
836 B
D
module command.simpleremotecontrol.app;
|
|
|
|
import command.simpleremotecontrol.simpleremotecontrol;
|
|
import command.simpleremotecontrol.lightoncommand;
|
|
import command.simpleremotecontrol.lightoffcommand;
|
|
import command.simpleremotecontrol.light;
|
|
import command.simpleremotecontrol.garagedooropencommand;
|
|
import command.simpleremotecontrol.garagedoor;
|
|
|
|
void main()
|
|
{
|
|
auto remote = new SimpleRemoteControl();
|
|
auto light = new Light();
|
|
auto lightOn = new LightOnCommand(light);
|
|
auto lightOff = new LightOffCommand(light);
|
|
auto garageDoor = new GarageDoor();
|
|
auto garageDoorOpen = new GarageDoorOpenCommand(garageDoor);
|
|
|
|
remote.setCommand(lightOn);
|
|
remote.buttonWasPressed();
|
|
remote.setCommand(lightOff);
|
|
remote.buttonWasPressed();
|
|
remote.setCommand(garageDoorOpen);
|
|
remote.buttonWasPressed();
|
|
}
|