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/strategy/quackbehavior.d

33 lines
415 B
D
Raw Normal View History

2022-11-09 21:22:13 +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");
}
}