29 lines
465 B
D
29 lines
465 B
D
|
module app;
|
||
|
|
||
|
import lib;
|
||
|
import std.stdio : writeln;
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
Duck duck = new MallardDuck();
|
||
|
|
||
|
Turkey turkey = new WildTurkey();
|
||
|
Duck turkeyAdapter = new TurkeyAdapter(turkey);
|
||
|
|
||
|
writeln("The Turkey says...");
|
||
|
turkey.gobble();
|
||
|
turkey.fly();
|
||
|
|
||
|
writeln("\nThe Duck says...");
|
||
|
testDuck(duck);
|
||
|
|
||
|
writeln("\nThe TurkeyAdapter says...");
|
||
|
testDuck(turkeyAdapter);
|
||
|
}
|
||
|
|
||
|
void testDuck(Duck duck)
|
||
|
{
|
||
|
duck.quack();
|
||
|
duck.fly();
|
||
|
}
|