patterns/strategy/quackbehavior.d

33 lines
415 B
D
Raw Normal View History

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