The same methods in different modules cause ambiguity

I have 2 modules. Each of them contains a Sub with the same name. See below:

Module moduleA
    Public Sub f(ByVal arg1 As myType)
        Console.WriteLine("module A")
    End Sub
End Module

Module moduleB
    Public Sub f(ByVal arg1 As myType, ByVal arg2 As Boolean)
        Console.WriteLine("module B")
    End Sub
End Module

      

But the compiler complains that there is an ambiguity between module A and module B.

How could this be? I have completely different signatures.

However, if I put 2 methods in the same module, there is no ambiguity there.

Can anyone tell me why?

Many thanks.

+2


a source to share


1 answer


You will need to fully qualify the method calls to stop the ambiguity. for example moduleA.f()

.



0


a source







All Articles