This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/command/simpleremotecontrol/app.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();
}