Interface abstraction

Frustrated c1514843 at drdrb.com
Tue Dec 31 16:54:34 PST 2013


On Wednesday, 1 January 2014 at 00:31:58 UTC, Adam D. Ruppe wrote:
> On Wednesday, 1 January 2014 at 00:31:03 UTC, Frustrated wrote:
>> auto a = new B; // should return cast(A)(new B);
>
> A a = new B;
>
>> case where a being of type B will hurt since it is always 
>> implicitly castable to type A.
>
> Right, it'll always be usable anyway.

I guess I was thinking just for consistency since I'll always 
being trying to use interfaces instead of classes. I guess it's 
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.


More information about the Digitalmars-d-learn mailing list