35 lines
530 B
D
35 lines
530 B
D
module theaterlights;
|
|
|
|
import std.stdio : writeln;
|
|
import std.conv : to;
|
|
|
|
class TheaterLights
|
|
{
|
|
private string description;
|
|
|
|
this(string description)
|
|
{
|
|
this.description = description;
|
|
}
|
|
|
|
void on()
|
|
{
|
|
writeln(description ~ " on");
|
|
}
|
|
|
|
void off()
|
|
{
|
|
writeln(description ~ " off");
|
|
}
|
|
|
|
void dim(int level)
|
|
{
|
|
writeln(description ~ " dimming to " ~ level.to!string ~ "%");
|
|
}
|
|
|
|
override string toString() const
|
|
{
|
|
return description;
|
|
}
|
|
}
|