This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/adapter/simpleadapter/app.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();
}