Last active
June 9, 2023 07:13
-
-
Save kalaiselvan369/0b913eaa2681853558bbb742abe70328 to your computer and use it in GitHub Desktop.
Importance of package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
// since the class is declared as internal, it is accessible to all the packages | |
// that are declared inside the same module. | |
internal class ApiClient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package service | |
import api.ApiClient | |
class Service { | |
val client = ApiClient() | |
// we were able to access internal class ApiClient inside this class because | |
// the file Api.kt is present inside a package named api | |
// therefore with help of import keyword we were able to access | |
// the file, class or top level members from another package and reuse it | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment