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/facade/hometheater/tuner.d

50 lines
874 B
D
Raw Normal View History

2022-11-16 13:43:46 +00:00
module tuner;
import amplifier;
import std.stdio : writeln;
import std.conv : to;
class Tuner
{
private string description;
private Amplifier amplifier;
private double frequency;
this(string description, Amplifier amplifier)
{
this.description = description;
this.amplifier = amplifier;
}
void on()
{
writeln(description ~ " on");
}
void off()
{
writeln(description ~ " off");
}
void setFrequency(double frequency)
{
writeln(description ~ " setting frequency to " ~ frequency.to!string);
this.frequency = frequency;
}
void setAm()
{
writeln(description ~ " setting AM mode");
}
void setFm()
{
writeln(description ~ " setting FM mode");
}
override string toString() const
{
return description;
}
}