33 lines
415 B
D
33 lines
415 B
D
|
module strategy.quackbehavior;
|
||
|
|
||
|
import std.stdio : writeln;
|
||
|
|
||
|
abstract interface QuackBehavior
|
||
|
{
|
||
|
void quack();
|
||
|
}
|
||
|
|
||
|
class Quack : QuackBehavior
|
||
|
{
|
||
|
override void quack()
|
||
|
{
|
||
|
writeln("Quack");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class Squeak : QuackBehavior
|
||
|
{
|
||
|
override void quack()
|
||
|
{
|
||
|
writeln("Squeak");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class MuteQuack : QuackBehavior
|
||
|
{
|
||
|
override void quack()
|
||
|
{
|
||
|
writeln("Silence");
|
||
|
}
|
||
|
}
|