... use of ... is hidden by ...; use alias ... to introduce base class overload set ??

Robert M. Münch robert.muench at saphirion.com
Wed Oct 23 09:43:08 UTC 2019


On 2019-10-22 20:59:41 +0000, Ali ‡ehreli said:

> That says "private paste" for me.

Ups, sorry and thanks for letting me know.


> But I think you have a member function template in the base class.

This the lib I use: 
https://github.com/lempiji/rx/blob/dev/source/rx/subject.d and which 
gives the error.

On lines 72ff it has:

    Disposable subscribe(T)(T observer)
    {
        return subscribe(observerObject!E(observer));
    }

    Disposable subscribe(Observer!E observer)
    {


Which looks exactly like what you mention, if I understand it correctly.

> Unfortunately, member function template instances are never virtual 
> functions, so you can't override them.

What I don't understand is:

1. The RX lib has a member function template and than an instance of it 
using type Oberver!E.

2. I'm creating a new type and want to use the same pattern but now 
with my type. But it seems that D reduces my own type which leads to 
the ambigty of which function now to use. Whereas I would expect that D 
uses the most specific type first.

> I'm pretty sure there is a way out. Can you try showing minimal code 
> again please.

The pastbin is the minimal code example. And yes, I'm sure there is a 
(simple) way out... for some advanced guys like you. Still learning a 
lot here...

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list