Re: Is it ok to inherit multiple times same templated interface?

2017-01-16 Thread Meta via Digitalmars-d-learn
On Sunday, 15 January 2017 at 23:25:25 UTC, Ryan wrote: How would overloading work? Overload resolution works based on function/method parameters, not return types. In the example you gave the 3 get functions are indistinguishable. If the template parameter was used for a method parameter

Re: Is it ok to inherit multiple times same templated interface?

2017-01-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 15 January 2017 at 20:33:30 UTC, Alexandru Ermicioi wrote: Currently doing so is allowed, though, it is impossible to call implemented methods directly from implementation. You should be able to do obj.Wr!(ubyte).get() too.

Re: Is it ok to inherit multiple times same templated interface?

2017-01-15 Thread Ryan via Digitalmars-d-learn
On Sunday, 15 January 2017 at 20:33:30 UTC, Alexandru Ermicioi wrote: Good day, Given following code example, where a templated interface Wr, and an implementation Im is present: interface Wr(T) { T get(); } class Im(T : ubyte) : Wr!ubyte, Wr!ushort, Wr!string { public T t;

Re: Is it ok to inherit multiple times same templated interface?

2017-01-15 Thread Dmitry Olshansky via Digitalmars-d-learn
On Sunday, 15 January 2017 at 20:33:30 UTC, Alexandru Ermicioi wrote: Good day, Given following code example, where a templated interface Wr, and an implementation Im is present: From the standpoint of the compiler they are 3 distinct interfaces, so all is good. interface Wr(T) { T