Visibility modifier 

The rule of thumb of encapsulation is to restrict the properties being accessible to the outside world and instead implement some functions to access class properties indirectly. Kotlin provides four visibility modifiers that hide the class members—public, private, protected, and internal. In this book, we will discuss public, private, and protected. Let's start by looking at the public and private modifiers.

The public is a default modifier that appears with each property and function if no other modifier is defined. The visibility modifier always appears before the declaration of a property or function:

public var name : String
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.226.240