Interface abstraction
Adam D. Ruppe
destructionator at gmail.com
Tue Dec 31 17:16:41 PST 2013
On Wednesday, 1 January 2014 at 00:54:35 UTC, Frustrated wrote:
> not a big deal though. In setting up little test units I'll end
> up using the classes and auto but probably not in the full
> project where I'll use factories and such.
Yeah, if you use your own factory methods, you can always just
have them return the interface.
Even as simple as:
InterfaceName make(Class, Args...)(Args args) { return new
Class(args); }
which explicitly returns the interface, so if you did
auto a = make!Foo(10, 20); // a is typed to the interface
More information about the Digitalmars-d-learn
mailing list