33 lines
442 B
D
33 lines
442 B
D
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!");
|
|
}
|
|
}
|