patterns/command/simpleremotecontrol/app.d

26 lines
836 B
D
Raw Normal View History

2022-12-05 07:38:19 +00:00
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();
}