patterns/adapter/simpleadapter/lib/turkeyadapter.d

28 lines
346 B
D
Raw Permalink Normal View History

2022-12-05 07:38:19 +00:00
module lib.turkeyadapter;
import lib.turkey;
import lib.duck;
class TurkeyAdapter : Duck
{
Turkey turkey;
this(Turkey turkey)
{
this.turkey = turkey;
}
void quack()
{
turkey.gobble();
}
void fly()
{
foreach (val; 0..5)
{
turkey.fly();
}
}
}