简体   繁体   中英

Kotlin: Unresolved reference on custom class instance

I have a Kotlin class named HttpsAuthenticator . The file in which that class resides is also by the same name. HttpsAuthenticator has an inner class named XYZ. Here is the code:

public class HttpsAuthenticator
{
    public class XYZ{

    }
}

在此处输入图片说明

From another class, when I instantiate each of those two classes, HttpsAuthenticator() fails with the error Unresolved reference . What is the difference. How do I instantiate HttpsAuthenticator ? Im absolutely new to Kotlin so I must be missing something basic I believe?

What ended up fixing it was simply adding import HttpsAuthenticator

Why XYZ was visible before that is beyond my comprehension at the moment. Im sure someone will come up with an explanation to this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM