Home > Enterprise >  Kotlin is the Open keyword a visibility modifier? [duplicate]
Kotlin is the Open keyword a visibility modifier? [duplicate]

Time:09-27

I'm new at Kotlin and I'm reading the kotlin official documentation, it states the 4 differents visibility modifiers (public, private, internal, protected) furthermore it's also using the keyword OPEN to express that a class can be extended (that is its purpose). My question is, can OPEN be considered as a Visibility Modifier?

CodePudding user response:

No, open is not a visibility modifier, as it does not affect visibility at all.

Instead, open affects if classes or methods can be extended/overridden and is the opposite of javas final in these cases.

  • Related