[英]Kotlin: Unresolved reference on custom class instance
我有一個名為HttpsAuthenticator的 Kotlin 類。 該類所在的文件也具有相同的名稱。 HttpsAuthenticator有一個名為 XYZ 的內部類。 這是代碼:
HttpsAuthenticator
public class HttpsAuthenticator { public class XYZ{ } }
在另一個類中,當我實例化這兩個類中的每一個時, HttpsAuthenticator()失敗並顯示錯誤Unresolved reference 。 有什么不同。 如何實例化HttpsAuthenticator ? 我對 Kotlin 完全陌生,所以我一定缺少一些我認為的基本知識?
HttpsAuthenticator()
Unresolved reference
最終修復它只是添加import HttpsAuthenticator
import HttpsAuthenticator
為什么在此之前 XYZ 是可見的,目前我無法理解。 我相信有人會對此做出解釋。
[英]Kotlin: Unresolved Reference for variable from instantiated class
[英]Unresolved reference to function in custom class
[英]kotlin Unresolved reference: Class of the other library module
[英]Unresolved reference: Coin in kotlin
[英]Kotlin : error: unresolved reference for a method inside a sealed class
[英]Unresolved attribute reference '__' for class '__'
[英]unresolved reference error for callable in another Kotlin file
[英]Unable to reference sub class in Kotlin
[英]reference instance attribute in child class
[英]c# class reference as opposed to instance reference
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.