patterns/strategy/flybehavior.d

33 lines
442 B
D
Raw Normal View History

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