28 lines
346 B
D
28 lines
346 B
D
|
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();
|
||
|
}
|
||
|
}
|
||
|
}
|