1

In Java or Dart, we can create package private class that can perform only into this package. From outside this package, we can't invoke this class or this class's methods. Do there any way to do this in kotlin?

Note : If I create class kotlin_class{} than I can't extends this class form other class in same package. I need to change it into open class ktolin_class{}. If I use open keyword here, this class can invoke from outside this package.

shariful islam
  • 389
  • 4
  • 18
  • 1
    There are four [visibility modifiers](https://kotlinlang.org/docs/reference/visibility-modifiers.html) in Kotlin: `private`, `protected`, `internal` and `public`. – jaco0646 Jan 21 '19 at 06:00
  • @jaco0646 I know these modifiers. That's why I want to know do there any way to do private package in kotlin or it's a limitation? – shariful islam Jan 21 '19 at 06:42
  • 1
    No, there is [no package private](https://stackoverflow.com/questions/35914095/package-protected-alternative-in-kotlin) in Kotlin. – Michi Gysel Jan 21 '19 at 07:23
  • Thanks @MichiGysel. I hope this is big limitation of kotlin. – shariful islam Jan 21 '19 at 07:29

0 Answers0