internal class Point {
internal val x = 0
public val y = 0
}
Since Point
class is internal, it is only accessible from within the same module. Wouldn't that make both x
and y
also accessible only from within the same module? If so, what is the difference between using internal
and public
inside an internal
class?
It's a distinction without a difference. The difference is that the public property y
will be gettable publicly, while x
will not be. In terms of equivalent java, y
would have a public getter method. But since the class itself is internal
there is no value to y's getter, at least in a pure Kotlin environment.
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.