I have the following generic class:
class Or<A,B>
{
Or (A a) {}
Or (B b) {}
}
Why do I get the following error when I try to compile it:
Or(A) is already defined in Or Or (B b) ^
It seems to me that the two constructors share the same signature although they have different generic type arguments. Why? And how to work around this problem?
Update
I understood the problem now. The compiler needs a way to distinguish the two types. Adding such a constrain would be ok for my use case. So I would like to add another question:
How to specify that the two types A and B may be anything but different?