I have the following general class:
class Or<A,B> { Or (A a) {} Or (B b) {} }
Why am I getting the following error when trying to compile it:
Or (A) is already defined in Or
Or (B b)
^
It seems to me that the two constructors have the same signature, although they have different common type arguments. What for? And how to get around this problem?
Update
Now I understand the problem. The compiler needs a way to distinguish between two types. Adding such a restriction would be good for my use case. So I would like to add one more question:
How to indicate that two types A and B can be something else?
source share