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/flybehavior.d

33 lines
442 B
D
Raw Normal View History

2022-11-09 21:22:13 +00:00
module strategy.flybehavior;
import std.stdio : writeln;
abstract interface FlyBehavior
{
void fly();
}
class FlyWithWings : FlyBehavior
{
override void fly()
{
writeln("I'm flying!");
}
}
class FlyNoWay : FlyBehavior
{
override void fly()
{
writeln("I can't fly");
}
}
class FlyRocketPowered : FlyBehavior
{
override void fly()
{
writeln("I'm flying with a rocket!");
}
}