Why is this reference ambiguous?

耗尽温柔 提交于 2019-12-05 03:52:43

There are two methods getMousePosition one without and one with a boolean parameter.

Without a type annotation Scala does not know if you want a reference to the method in one parameter (a Function1 object) or if you want to invoke the one without parameters (resulting in a Point).

Specifying the expected type clarifies your intend.

Using getMousePosition() should work as well.

A more direct way to refer to the desired overloaded alternative is by including the empty argument list.

peer.getMousePosition()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!