![](/img/trans.png)
[英]The way to differ two functions with the same name in available scope in Scala
[英]Scope of implicit functions in objects with the same name as the class in scala
問題很簡單:在Scala中,對象A的隱式函數定義是否在類A的范圍內? 還是我必須顯式使用import A._
來訪問隱式函數?
問題很簡單:在Scala中,對象A的隱式函數定義是否在類A的范圍內?
不,您必須導入它們(與object A
非隱式成員相同)。 但是,當然,如果范圍內沒有任何隱含轉換,則總是在同伴對象中搜索從A
到A
任何隱式轉換。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.